@nivaro/react 0.3.139 → 0.3.141
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/components/InlineGridField.js +95 -92
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +39 -2
- package/dist/shared/components/AudienceConfirmPanel.js +19 -19
- package/dist/shared/components/BroadcastView.js +213 -211
- package/dist/shared/components/CollectionBrowserView.js +2702 -2671
- package/dist/shared/components/ConfigHistory.js +45 -45
- package/dist/shared/components/ConformanceView.js +110 -110
- package/dist/shared/components/DataTable.js +51 -51
- package/dist/shared/components/FilePreviewLightbox.js +26 -25
- package/dist/shared/components/ItemEditForm.js +3475 -3458
- package/dist/shared/components/LiveCount.js +27 -23
- package/dist/shared/components/LiveTraceView.js +62 -61
- package/dist/shared/components/PageRenderer.js +422 -410
- package/dist/shared/components/ProfileView.js +199 -199
- package/dist/shared/components/QualityRulesView.js +70 -70
- package/dist/shared/components/QueryTable.js +131 -130
- package/dist/shared/components/RecordGraph.js +98 -98
- package/dist/shared/components/RecordReadView.js +287 -288
- package/dist/shared/components/ReportView.js +1279 -1259
- package/dist/shared/components/RowPresence.js +83 -76
- package/dist/shared/components/SlaRulesView.js +73 -74
- package/dist/shared/components/UnseenDot.js +183 -22
- package/dist/shared/components/WidgetSlot.js +73 -73
- package/dist/shared/components/ai/AiChart.js +36 -32
- package/dist/shared/components/ai/AiMarkdown.js +136 -129
- package/dist/shared/components/ai/TaskDo.js +87 -87
- package/dist/shared/components/ai/answer-formats.js +37 -30
- package/dist/shared/components/ai/call-log/format.js +17 -16
- package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
- package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
- package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
- package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
- package/dist/shared/components/bulk/bulk-field-options.js +10 -10
- package/dist/shared/components/cbv/column-totals.js +53 -51
- package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
- package/dist/shared/components/command-center/announce.js +7 -6
- package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
- package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
- package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
- package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
- package/dist/shared/components/delivery-analytics/drill.js +32 -32
- package/dist/shared/components/imports/RunDetailSheet.js +1 -1
- package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
- package/dist/shared/components/integrations/console/EventsView.js +35 -35
- package/dist/shared/components/integrations/console/FirefightView.js +15 -14
- package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
- package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
- package/dist/shared/components/integrations/console/SignalCard.js +67 -67
- package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
- package/dist/shared/components/item-edit/ChangesTray.js +88 -74
- package/dist/shared/components/item-edit/FilePickerField.js +123 -123
- package/dist/shared/components/item-edit/GroupSection.js +301 -292
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
- package/dist/shared/components/item-edit/InlineGridField.js +45 -36
- package/dist/shared/components/item-edit/InlineTableField.js +1390 -1376
- package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
- package/dist/shared/components/item-edit/RecordRecapChanges.js +116 -74
- package/dist/shared/components/item-edit/RecordRecapStrip.js +148 -160
- package/dist/shared/components/item-edit/summary-layout-request.js +15 -0
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +226 -157
- package/dist/shared/components/layout-editor/settings/WhoSection.js +53 -52
- package/dist/shared/components/layout-editor/settings/controls.js +98 -90
- package/dist/shared/components/layout-editor/settings/settings-registry.js +8 -0
- package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
- package/dist/shared/components/ops-report/format.js +37 -36
- package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
- package/dist/shared/components/panels/RevisionsPanel.js +306 -305
- package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
- package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
- package/dist/shared/components/pipeline/TeamsView.js +189 -130
- package/dist/shared/components/profile/AgentsPanel.js +6 -6
- package/dist/shared/components/profile/DelegationCard.js +13 -12
- package/dist/shared/components/profile/PersonActivity.js +48 -48
- package/dist/shared/components/profile/PersonExtras.js +107 -107
- package/dist/shared/components/profile/PersonWeek.js +9 -9
- package/dist/shared/components/queue/QueueBulkBar.js +19 -18
- package/dist/shared/components/queue/QueueBulkMove.js +21 -20
- package/dist/shared/components/queue/QueueItemSheet.js +136 -131
- package/dist/shared/components/queue/QueueWorklist.js +884 -872
- package/dist/shared/components/queue/worklist-helpers.js +36 -21
- package/dist/shared/components/support/RequestList.js +123 -123
- package/dist/shared/components/support/SupportAnalytics.js +29 -29
- package/dist/shared/lib/activity-sentence.js +251 -229
- package/dist/shared/lib/format-value.js +5 -4
- package/dist/shared/lib/layout-resolve.js +64 -48
- package/dist/shared/lib/number-format.js +87 -0
- package/dist/shared/lib/number-kind.js +133 -0
- package/dist/shared/lib/utils.js +24 -20
- package/dist/shared/lib/watch-list.js +1 -1
- package/dist/shared/lib/widget-value-format.js +26 -12
- package/package.json +1 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsxs as p, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Loader2 as
|
|
4
|
-
import { useMemo as
|
|
2
|
+
import { useQueryClient as Le, useQuery as L } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as je, Pencil as Fe, X as $e } from "lucide-react";
|
|
4
|
+
import { useMemo as j, useRef as Te, useEffect as Se, useState as F, Fragment as Me } from "react";
|
|
5
5
|
import { useNivaroClient as Ae } from "../../context.js";
|
|
6
6
|
import { get as z, post as Je, patch as Ye, del as Ie } from "../../lib/commands.js";
|
|
7
|
+
import { formatFieldNumber as Ue } from "../../lib/number-format.js";
|
|
7
8
|
import { fetchCollectionRelations as pe, queryKeys as O } from "../../lib/query-keys.js";
|
|
8
|
-
import { titleCase as C, cn as xe, toLocalDateString as
|
|
9
|
+
import { titleCase as C, cn as xe, toLocalDateString as Re } from "../../lib/utils.js";
|
|
9
10
|
import { FieldRenderer as be } from "./FieldRenderer.js";
|
|
10
|
-
import { SENTINEL_FIELDS as
|
|
11
|
-
|
|
11
|
+
import { SENTINEL_FIELDS as We, EMPTY_NESTED_OPS as ee, applyDisplayTemplate as ze } from "./helpers.js";
|
|
12
|
+
import { numberKindOf as Be } from "../../lib/number-kind.js";
|
|
13
|
+
const Ge = /* @__PURE__ */ new Set([
|
|
12
14
|
"alias",
|
|
13
15
|
"o2m",
|
|
14
16
|
"m2m",
|
|
@@ -16,32 +18,32 @@ const ze = /* @__PURE__ */ new Set([
|
|
|
16
18
|
"presentation",
|
|
17
19
|
"group",
|
|
18
20
|
"divider"
|
|
19
|
-
]),
|
|
20
|
-
function
|
|
21
|
-
return
|
|
21
|
+
]), Qe = /* @__PURE__ */ new Set(["__apply_values__", "__create_with_defaults__"]);
|
|
22
|
+
function Ve(a, l) {
|
|
23
|
+
return a === l || a == null && l == null ? !0 : a == null || l == null ? !1 : typeof a == "string" && typeof l == "number" || typeof a == "number" && typeof l == "string" ? String(a) === String(l) : JSON.stringify(a) === JSON.stringify(l);
|
|
22
24
|
}
|
|
23
|
-
function ye(
|
|
25
|
+
function ye(a) {
|
|
24
26
|
var x;
|
|
25
|
-
const
|
|
26
|
-
if ((x =
|
|
27
|
-
const q =
|
|
27
|
+
const l = a == null ? void 0 : a.response;
|
|
28
|
+
if ((x = l == null ? void 0 : l.violations) != null && x.length) {
|
|
29
|
+
const q = l.violations.map((b) => b.explanation).filter(Boolean).join("; ");
|
|
28
30
|
if (q) return q;
|
|
29
31
|
}
|
|
30
|
-
return
|
|
32
|
+
return l != null && l.message ? l.message : l != null && l.error ? l.error : a instanceof Error && a.message ? a.message : "Save failed";
|
|
31
33
|
}
|
|
32
|
-
function
|
|
33
|
-
if (!Number.isFinite(
|
|
34
|
-
const
|
|
35
|
-
return Object.is(
|
|
34
|
+
function Xe(a) {
|
|
35
|
+
if (!Number.isFinite(a)) return a;
|
|
36
|
+
const l = Math.round((a + Math.sign(a) * Number.EPSILON) * 100) / 100;
|
|
37
|
+
return Object.is(l, -0) ? 0 : l;
|
|
36
38
|
}
|
|
37
|
-
function
|
|
38
|
-
parentCollection:
|
|
39
|
-
relationField:
|
|
39
|
+
function ct({
|
|
40
|
+
parentCollection: a,
|
|
41
|
+
relationField: l,
|
|
40
42
|
parentRowId: x,
|
|
41
43
|
stagedMembers: q,
|
|
42
44
|
onStagedChange: b,
|
|
43
45
|
parentDraft: Ne,
|
|
44
|
-
hint:
|
|
46
|
+
hint: _,
|
|
45
47
|
readOnly: v = !1,
|
|
46
48
|
outerGridInvalidateKey: te,
|
|
47
49
|
deferred: $ = !1,
|
|
@@ -53,31 +55,31 @@ function st({
|
|
|
53
55
|
matchSeed: M
|
|
54
56
|
}) {
|
|
55
57
|
var ue, fe;
|
|
56
|
-
const y = Ae(), re =
|
|
57
|
-
queryKey: O.collectionRelations(
|
|
58
|
-
queryFn: () => pe(y,
|
|
58
|
+
const y = Ae(), re = Le(), { data: A, isLoading: he } = L({
|
|
59
|
+
queryKey: O.collectionRelations(a),
|
|
60
|
+
queryFn: () => pe(y, a),
|
|
59
61
|
staleTime: 10 * 6e4
|
|
60
|
-
}), P =
|
|
62
|
+
}), P = j(
|
|
61
63
|
() => A == null ? void 0 : A.find(
|
|
62
|
-
(e) => e.one_collection ===
|
|
64
|
+
(e) => e.one_collection === a && e.one_field === l
|
|
63
65
|
),
|
|
64
|
-
[A,
|
|
65
|
-
), d = m ?? (P == null ? void 0 : P.many_collection) ?? null, g = m ? null : (P == null ? void 0 : P.many_field) ?? null, { data: J = [] } =
|
|
66
|
+
[A, a, l]
|
|
67
|
+
), d = m ?? (P == null ? void 0 : P.many_collection) ?? null, g = m ? null : (P == null ? void 0 : P.many_field) ?? null, { data: J = [] } = L({
|
|
66
68
|
queryKey: O.collectionRelations(d),
|
|
67
69
|
queryFn: () => pe(y, d),
|
|
68
70
|
enabled: !!d,
|
|
69
71
|
staleTime: 10 * 6e4
|
|
70
|
-
}), { data: G = [] } =
|
|
72
|
+
}), { data: G = [] } = L({
|
|
71
73
|
queryKey: O.fieldConfig(d, null),
|
|
72
74
|
queryFn: () => y.request(z(`/field-config/${d}`)).then((e) => e.data ?? []),
|
|
73
75
|
enabled: !!d,
|
|
74
76
|
staleTime: 6e4
|
|
75
|
-
}), E =
|
|
77
|
+
}), E = j(
|
|
76
78
|
() => G.filter(
|
|
77
|
-
(e) => !e.hidden && !
|
|
79
|
+
(e) => !e.hidden && !Ge.has(e.type) && e.field !== g && !(M && e.field in M) && e.field !== "id" && !We.has(e.field) && !Qe.has(e.group_key ?? "")
|
|
78
80
|
),
|
|
79
81
|
[G, g]
|
|
80
|
-
), ie = m ? ["nested-rows", d, JSON.stringify(S ?? null)] : ["nested-rows", d, g, x], { data: Y = [], isLoading: Q } =
|
|
82
|
+
), ie = m ? ["nested-rows", d, JSON.stringify(S ?? null)] : ["nested-rows", d, g, x], { data: Y = [], isLoading: Q } = L({
|
|
81
83
|
queryKey: ie,
|
|
82
84
|
queryFn: () => y.request(
|
|
83
85
|
z(`/items/${d}`, {
|
|
@@ -89,14 +91,14 @@ function st({
|
|
|
89
91
|
).then((e) => e.data ?? []),
|
|
90
92
|
enabled: m ? !!S : !!d && !!g && x != null,
|
|
91
93
|
staleTime: 3e4
|
|
92
|
-
}), N =
|
|
94
|
+
}), N = j(() => {
|
|
93
95
|
if (x != null) {
|
|
94
96
|
if ($) {
|
|
95
|
-
const e = T ?? ee, t = new Set(e.deleted), r = new Map(e.updated.map((
|
|
96
|
-
const u = r.get(String(
|
|
97
|
-
return { key: String(
|
|
98
|
-
}), n = e.created.map((
|
|
99
|
-
return [...
|
|
97
|
+
const e = T ?? ee, t = new Set(e.deleted), r = new Map(e.updated.map((s) => [s.id, s.changes])), o = Y.filter((s) => !t.has(String(s.id))).map((s) => {
|
|
98
|
+
const u = r.get(String(s.id));
|
|
99
|
+
return { key: String(s.id), data: u ? { ...s, ...u } : s };
|
|
100
|
+
}), n = e.created.map((s, u) => ({ key: `created:${u}`, data: s }));
|
|
101
|
+
return [...o, ...n];
|
|
100
102
|
}
|
|
101
103
|
return Y.map((e) => ({ key: String(e.id), data: e }));
|
|
102
104
|
}
|
|
@@ -107,18 +109,18 @@ function st({
|
|
|
107
109
|
const e = JSON.stringify(N.map((t) => t.data));
|
|
108
110
|
e !== ne.current && (ne.current = e, B(N.map((t) => t.data)));
|
|
109
111
|
}, [N, B]);
|
|
110
|
-
const [c, V] = F(null), [h, I] = F({}), [
|
|
112
|
+
const [c, V] = F(null), [h, I] = F({}), [we, X] = F(null), [U, se] = F(!1), [R, w] = F(null);
|
|
111
113
|
function le(e, t) {
|
|
112
|
-
I((r) => ({ ...r, [e]: t })),
|
|
114
|
+
I((r) => ({ ...r, [e]: t })), w(null);
|
|
113
115
|
}
|
|
114
|
-
function
|
|
115
|
-
v || (V("new"), I({}),
|
|
116
|
+
function _e() {
|
|
117
|
+
v || (V("new"), I({}), w(null));
|
|
116
118
|
}
|
|
117
119
|
function oe(e, t) {
|
|
118
|
-
v || (V(e), I({ ...t }),
|
|
120
|
+
v || (V(e), I({ ...t }), w(null));
|
|
119
121
|
}
|
|
120
122
|
function D() {
|
|
121
|
-
V(null), I({}),
|
|
123
|
+
V(null), I({}), w(null);
|
|
122
124
|
}
|
|
123
125
|
function ae() {
|
|
124
126
|
re.invalidateQueries({ queryKey: ie }), te && re.invalidateQueries({ queryKey: te });
|
|
@@ -126,20 +128,20 @@ function st({
|
|
|
126
128
|
async function ce() {
|
|
127
129
|
if (!c) return;
|
|
128
130
|
if (x != null && d && (g || m)) {
|
|
129
|
-
const t = new Set(E.map((
|
|
130
|
-
Object.entries(h).filter(([
|
|
131
|
+
const t = new Set(E.map((o) => o.field)), r = Object.fromEntries(
|
|
132
|
+
Object.entries(h).filter(([o]) => t.has(o))
|
|
131
133
|
);
|
|
132
134
|
if ($) {
|
|
133
|
-
const
|
|
135
|
+
const o = T ?? ee, n = m ? { ...o, collection: m } : o, s = m ? { ...r, ...M ?? {} } : r;
|
|
134
136
|
if (c === "new")
|
|
135
|
-
f == null || f({ ...n, created: [...n.created,
|
|
137
|
+
f == null || f({ ...n, created: [...n.created, s] });
|
|
136
138
|
else if (c.startsWith("created:")) {
|
|
137
139
|
const u = parseInt(c.slice(8), 10), K = [...n.created];
|
|
138
|
-
K[u] =
|
|
140
|
+
K[u] = s, f == null || f({ ...n, created: K });
|
|
139
141
|
} else {
|
|
140
|
-
const u = Y.find((
|
|
141
|
-
Object.entries(r).filter(([
|
|
142
|
-
), me = n.updated.filter((
|
|
142
|
+
const u = Y.find((k) => String(k.id) === c), K = Object.fromEntries(
|
|
143
|
+
Object.entries(r).filter(([k, ke]) => !Ve(ke, u == null ? void 0 : u[k]))
|
|
144
|
+
), me = n.updated.filter((k) => k.id !== c);
|
|
143
145
|
Object.keys(K).length > 0 && me.push({ id: c, changes: K }), f == null || f({ ...n, updated: me });
|
|
144
146
|
}
|
|
145
147
|
D();
|
|
@@ -153,8 +155,8 @@ function st({
|
|
|
153
155
|
...m ? M ?? {} : { [g]: x }
|
|
154
156
|
})
|
|
155
157
|
) : await y.request(Ye(`/items/${d}/${c}`, r)), ae(), D();
|
|
156
|
-
} catch (
|
|
157
|
-
|
|
158
|
+
} catch (o) {
|
|
159
|
+
w(ye(o));
|
|
158
160
|
} finally {
|
|
159
161
|
se(!1);
|
|
160
162
|
}
|
|
@@ -174,47 +176,47 @@ function st({
|
|
|
174
176
|
if ($) {
|
|
175
177
|
const t = T ?? ee, r = m ? { ...t, collection: m } : t;
|
|
176
178
|
if (e.startsWith("created:")) {
|
|
177
|
-
const
|
|
178
|
-
f == null || f({ ...r, created: r.created.filter((n,
|
|
179
|
+
const o = parseInt(e.slice(8), 10);
|
|
180
|
+
f == null || f({ ...r, created: r.created.filter((n, s) => s !== o) });
|
|
179
181
|
} else
|
|
180
182
|
f == null || f({
|
|
181
183
|
...r,
|
|
182
|
-
updated: r.updated.filter((
|
|
184
|
+
updated: r.updated.filter((o) => o.id !== e),
|
|
183
185
|
deleted: r.deleted.includes(e) ? r.deleted : [...r.deleted, e]
|
|
184
186
|
});
|
|
185
187
|
} else
|
|
186
188
|
try {
|
|
187
189
|
await y.request(Ie(`/items/${d}/${e}`)), ae();
|
|
188
190
|
} catch (t) {
|
|
189
|
-
|
|
191
|
+
w(ye(t));
|
|
190
192
|
return;
|
|
191
193
|
}
|
|
192
194
|
else {
|
|
193
195
|
const t = parseInt(e.slice(7), 10);
|
|
194
|
-
b == null || b((q ?? []).filter((r,
|
|
196
|
+
b == null || b((q ?? []).filter((r, o) => o !== t));
|
|
195
197
|
}
|
|
196
|
-
X(null),
|
|
198
|
+
X(null), w(null), c === e && D();
|
|
197
199
|
}
|
|
198
|
-
const H =
|
|
200
|
+
const H = j(() => {
|
|
199
201
|
const e = /* @__PURE__ */ new Map();
|
|
200
202
|
for (const t of E) {
|
|
201
203
|
const r = J.find(
|
|
202
|
-
(
|
|
204
|
+
(o) => o.many_collection === d && o.many_field === t.field && !o.junction_field
|
|
203
205
|
);
|
|
204
206
|
r != null && r.one_collection && e.set(t.field, r);
|
|
205
207
|
}
|
|
206
208
|
return e;
|
|
207
|
-
}, [E, J, d]), Z =
|
|
209
|
+
}, [E, J, d]), Z = j(() => {
|
|
208
210
|
const e = /* @__PURE__ */ new Map();
|
|
209
211
|
for (const { key: t, data: r } of N) {
|
|
210
|
-
const
|
|
211
|
-
for (const [n,
|
|
212
|
-
const u =
|
|
213
|
-
u == null || u === "" || !
|
|
212
|
+
const o = c === t ? h : r;
|
|
213
|
+
for (const [n, s] of H) {
|
|
214
|
+
const u = o[n];
|
|
215
|
+
u == null || u === "" || !s.one_collection || (e.has(s.one_collection) || e.set(s.one_collection, /* @__PURE__ */ new Set()), e.get(s.one_collection).add(String(u)));
|
|
214
216
|
}
|
|
215
217
|
}
|
|
216
218
|
return e;
|
|
217
|
-
}, [N, c, h, H]), { data: ge = {} } =
|
|
219
|
+
}, [N, c, h, H]), { data: ge = {} } = L({
|
|
218
220
|
queryKey: [
|
|
219
221
|
"nested-m2o-display",
|
|
220
222
|
d,
|
|
@@ -224,8 +226,8 @@ function st({
|
|
|
224
226
|
const e = {};
|
|
225
227
|
return await Promise.all(
|
|
226
228
|
[...Z.entries()].map(async ([t, r]) => {
|
|
227
|
-
var
|
|
228
|
-
const [
|
|
229
|
+
var s;
|
|
230
|
+
const [o, n] = await Promise.all([
|
|
229
231
|
y.request(
|
|
230
232
|
z(`/collections/${t}`)
|
|
231
233
|
),
|
|
@@ -238,8 +240,8 @@ function st({
|
|
|
238
240
|
]);
|
|
239
241
|
e[t] = {};
|
|
240
242
|
for (const u of n.data ?? [])
|
|
241
|
-
e[t][String(u.id)] =
|
|
242
|
-
(
|
|
243
|
+
e[t][String(u.id)] = ze(
|
|
244
|
+
(s = o.data) == null ? void 0 : s.display_template,
|
|
243
245
|
u
|
|
244
246
|
);
|
|
245
247
|
})
|
|
@@ -249,42 +251,47 @@ function st({
|
|
|
249
251
|
staleTime: 6e4
|
|
250
252
|
});
|
|
251
253
|
function qe(e, t) {
|
|
252
|
-
var
|
|
254
|
+
var n;
|
|
253
255
|
if (t == null || t === "")
|
|
254
256
|
return /* @__PURE__ */ i("span", { className: "text-slate-300", children: "—" });
|
|
255
257
|
const r = H.get(e.field);
|
|
256
258
|
if (r != null && r.one_collection) {
|
|
257
|
-
const
|
|
258
|
-
return /* @__PURE__ */ i("span", { className: "block truncate", children:
|
|
259
|
+
const s = (n = ge[r.one_collection]) == null ? void 0 : n[String(t)];
|
|
260
|
+
return /* @__PURE__ */ i("span", { className: "block truncate", children: s ?? String(t) });
|
|
259
261
|
}
|
|
260
262
|
if (e.type === "boolean")
|
|
261
263
|
return /* @__PURE__ */ i("span", { className: t ? "text-emerald-600" : "text-slate-400", children: t ? "Yes" : "No" });
|
|
262
264
|
if (e.type === "datetime" || e.type === "date")
|
|
263
265
|
try {
|
|
264
|
-
return /* @__PURE__ */ i("span", { className: "block truncate", children:
|
|
266
|
+
return /* @__PURE__ */ i("span", { className: "block truncate", children: Re(t) });
|
|
265
267
|
} catch {
|
|
266
268
|
}
|
|
269
|
+
const o = Be(e);
|
|
270
|
+
if (o && o !== "plain") {
|
|
271
|
+
const s = Ue(t, e);
|
|
272
|
+
if (s) return /* @__PURE__ */ i("span", { className: "block truncate tabular-nums", children: s });
|
|
273
|
+
}
|
|
267
274
|
return /* @__PURE__ */ i("span", { className: "block truncate", children: String(t) });
|
|
268
275
|
}
|
|
269
|
-
const Ee =
|
|
276
|
+
const Ee = _ && Number(Ne[_.cap_field]) || 0, Pe = _ ? N.reduce(
|
|
270
277
|
(e, t) => {
|
|
271
278
|
const r = c === t.key ? h : t.data;
|
|
272
|
-
return e + (Number(r[
|
|
279
|
+
return e + (Number(r[_.sum_field]) || 0);
|
|
273
280
|
},
|
|
274
|
-
c === "new" && Number(h[
|
|
275
|
-
) : 0, de =
|
|
281
|
+
c === "new" && Number(h[_.sum_field]) || 0
|
|
282
|
+
) : 0, de = Xe(Ee - Pe), De = _ ? ((fe = (ue = G.find((e) => e.field === _.sum_field)) == null ? void 0 : ue.options) == null ? void 0 : fe.format) === "currency" : !1;
|
|
276
283
|
if (he && !m || !d || !g && !m) return null;
|
|
277
284
|
if (m && !S)
|
|
278
285
|
return /* @__PURE__ */ p("p", { className: "rounded-md border border-slate-200 bg-slate-50 px-2 py-1.5 text-[11px] text-slate-400", children: [
|
|
279
|
-
C(
|
|
286
|
+
C(l),
|
|
280
287
|
" — available after this row is saved."
|
|
281
288
|
] });
|
|
282
289
|
const Ke = v ? 0 : 1, W = E.length + Ke;
|
|
283
290
|
return /* @__PURE__ */ p("div", { className: "overflow-hidden rounded-md border border-slate-200", children: [
|
|
284
291
|
/* @__PURE__ */ p("div", { className: "flex items-center gap-2 px-2 py-1 bg-slate-50 border-b border-slate-200", children: [
|
|
285
|
-
/* @__PURE__ */ i("span", { className: "text-[10px] font-medium text-slate-400 uppercase tracking-wide", children: C(
|
|
292
|
+
/* @__PURE__ */ i("span", { className: "text-[10px] font-medium text-slate-400 uppercase tracking-wide", children: C(l) }),
|
|
286
293
|
/* @__PURE__ */ i("span", { className: "rounded bg-slate-100 px-1.5 py-0.5 text-[10px] font-medium text-slate-500", children: N.length }),
|
|
287
|
-
|
|
294
|
+
_ && /* @__PURE__ */ p(
|
|
288
295
|
"span",
|
|
289
296
|
{
|
|
290
297
|
className: xe(
|
|
@@ -293,7 +300,7 @@ function st({
|
|
|
293
300
|
),
|
|
294
301
|
children: [
|
|
295
302
|
"remaining: ",
|
|
296
|
-
|
|
303
|
+
He(de, De)
|
|
297
304
|
]
|
|
298
305
|
}
|
|
299
306
|
)
|
|
@@ -311,9 +318,9 @@ function st({
|
|
|
311
318
|
!v && /* @__PURE__ */ i("th", { className: "w-16" })
|
|
312
319
|
] }) }),
|
|
313
320
|
/* @__PURE__ */ p("tbody", { children: [
|
|
314
|
-
Q && /* @__PURE__ */ i("tr", { children: /* @__PURE__ */ i("td", { colSpan: W, className: "px-2 py-3 text-center text-slate-400", children: /* @__PURE__ */ i(
|
|
321
|
+
Q && /* @__PURE__ */ i("tr", { children: /* @__PURE__ */ i("td", { colSpan: W, className: "px-2 py-3 text-center text-slate-400", children: /* @__PURE__ */ i(je, { className: "h-3.5 w-3.5 animate-spin inline" }) }) }),
|
|
315
322
|
!Q && N.map(({ key: e, data: t }) => {
|
|
316
|
-
const r = c === e,
|
|
323
|
+
const r = c === e, o = we === e;
|
|
317
324
|
return /* @__PURE__ */ p(Me, { children: [
|
|
318
325
|
/* @__PURE__ */ p(
|
|
319
326
|
"tr",
|
|
@@ -330,7 +337,7 @@ function st({
|
|
|
330
337
|
{
|
|
331
338
|
field: n,
|
|
332
339
|
value: h[n.field] ?? null,
|
|
333
|
-
onChange: (
|
|
340
|
+
onChange: (s) => le(n.field, s),
|
|
334
341
|
relations: J,
|
|
335
342
|
collection: d,
|
|
336
343
|
itemId: x != null ? e : "new"
|
|
@@ -360,7 +367,7 @@ function st({
|
|
|
360
367
|
children: "✕"
|
|
361
368
|
}
|
|
362
369
|
)
|
|
363
|
-
] }) :
|
|
370
|
+
] }) : o ? /* @__PURE__ */ p("div", { className: "flex items-center justify-end gap-1", children: [
|
|
364
371
|
/* @__PURE__ */ i("span", { className: "text-[10px] text-slate-400", children: "Delete?" }),
|
|
365
372
|
/* @__PURE__ */ i(
|
|
366
373
|
"button",
|
|
@@ -378,7 +385,7 @@ function st({
|
|
|
378
385
|
{
|
|
379
386
|
type: "button",
|
|
380
387
|
onClick: (n) => {
|
|
381
|
-
n.stopPropagation(), X(null),
|
|
388
|
+
n.stopPropagation(), X(null), w(null);
|
|
382
389
|
},
|
|
383
390
|
className: "rounded px-1.5 py-0.5 text-[10px] text-slate-400 hover:text-slate-700 border border-slate-200",
|
|
384
391
|
children: "Cancel"
|
|
@@ -401,7 +408,7 @@ function st({
|
|
|
401
408
|
{
|
|
402
409
|
type: "button",
|
|
403
410
|
onClick: (n) => {
|
|
404
|
-
n.stopPropagation(), X(e),
|
|
411
|
+
n.stopPropagation(), X(e), w(null);
|
|
405
412
|
},
|
|
406
413
|
className: "rounded p-0.5 text-slate-300 hover:text-red-500",
|
|
407
414
|
children: /* @__PURE__ */ i($e, { className: "h-3 w-3" })
|
|
@@ -411,7 +418,7 @@ function st({
|
|
|
411
418
|
]
|
|
412
419
|
}
|
|
413
420
|
),
|
|
414
|
-
(r ||
|
|
421
|
+
(r || o) && R && /* @__PURE__ */ i("tr", { className: "border-b border-slate-100 bg-red-50/50", children: /* @__PURE__ */ i("td", { colSpan: W, className: "px-2 py-1 text-[11px] text-red-600", children: R }) })
|
|
415
422
|
] }, e);
|
|
416
423
|
}),
|
|
417
424
|
c === "new" && /* @__PURE__ */ p("tr", { className: "border-b border-slate-100 bg-[#f0fbff] dark:bg-nvr-cyan/5", children: [
|
|
@@ -463,21 +470,21 @@ function st({
|
|
|
463
470
|
"button",
|
|
464
471
|
{
|
|
465
472
|
type: "button",
|
|
466
|
-
onClick:
|
|
473
|
+
onClick: _e,
|
|
467
474
|
className: "text-[11px] text-nvr-cyan font-medium hover:underline",
|
|
468
475
|
children: "+ Add row"
|
|
469
476
|
}
|
|
470
477
|
) })
|
|
471
478
|
] });
|
|
472
479
|
}
|
|
473
|
-
function
|
|
474
|
-
return
|
|
475
|
-
minimumFractionDigits: Number.isInteger(
|
|
480
|
+
function He(a, l) {
|
|
481
|
+
return l ? a.toLocaleString("en-US", { style: "currency", currency: "USD" }) : a.toLocaleString("en-US", {
|
|
482
|
+
minimumFractionDigits: Number.isInteger(a) ? 0 : 2,
|
|
476
483
|
maximumFractionDigits: 2
|
|
477
484
|
});
|
|
478
485
|
}
|
|
479
486
|
export {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
487
|
+
ct as NestedRelationEditor,
|
|
488
|
+
He as formatRemaining,
|
|
489
|
+
Xe as roundCents
|
|
483
490
|
};
|
|
@@ -6,19 +6,19 @@ import { useNivaroClient as N } from "../../context.js";
|
|
|
6
6
|
import { get as _ } from "../../lib/commands.js";
|
|
7
7
|
import { useLiveAvailable as C, useLiveRecordEvent as q } from "../../lib/live.js";
|
|
8
8
|
import { useLivePreference as O } from "../../lib/live-preference.js";
|
|
9
|
-
import { formatRelative as R } from "../../lib/utils.js";
|
|
10
|
-
import { openChatRoom as
|
|
11
|
-
import { Popover as
|
|
9
|
+
import { formatRelative as R, formatNumber as $ } from "../../lib/utils.js";
|
|
10
|
+
import { openChatRoom as P, canOpenChatRoom as A } from "../chat/chat-core.js";
|
|
11
|
+
import { Popover as F, PopoverTrigger as L, PopoverContent as M } from "../ui/popover.js";
|
|
12
12
|
function o(t) {
|
|
13
13
|
if (t.rooms.length === 0) return "";
|
|
14
14
|
const s = t.rooms.length === 1 ? t.rooms[0].label : `${t.rooms.length} chats`;
|
|
15
15
|
return `${t.new_total > 0 ? "Being discussed in" : "Discussed in"} ${s}${t.new_total > 0 ? ` (${t.new_total} new)` : ""}`;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function H({
|
|
18
18
|
collection: t,
|
|
19
19
|
itemId: s
|
|
20
20
|
}) {
|
|
21
|
-
const l = N(), h = k(), x = C(), i = O(), [b, d] = v(!1), c =
|
|
21
|
+
const l = N(), h = k(), x = C(), i = O(), [b, d] = v(!1), c = A(), u = ["nvr-chat-record-room", "mentions", t, s];
|
|
22
22
|
q(
|
|
23
23
|
"record:chat",
|
|
24
24
|
t,
|
|
@@ -44,8 +44,8 @@ function G({
|
|
|
44
44
|
});
|
|
45
45
|
if (!a || a.rooms.length === 0) return null;
|
|
46
46
|
const m = a.new_total > 0;
|
|
47
|
-
return /* @__PURE__ */ r(
|
|
48
|
-
/* @__PURE__ */ n(
|
|
47
|
+
return /* @__PURE__ */ r(F, { open: b, onOpenChange: d, children: [
|
|
48
|
+
/* @__PURE__ */ n(L, { asChild: !0, children: /* @__PURE__ */ r(
|
|
49
49
|
"button",
|
|
50
50
|
{
|
|
51
51
|
type: "button",
|
|
@@ -60,13 +60,13 @@ function G({
|
|
|
60
60
|
]
|
|
61
61
|
}
|
|
62
62
|
) }),
|
|
63
|
-
/* @__PURE__ */ n(
|
|
63
|
+
/* @__PURE__ */ n(M, { align: "start", className: "w-[280px] p-1", children: /* @__PURE__ */ n("ul", { children: a.rooms.map((e) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ r(
|
|
64
64
|
"button",
|
|
65
65
|
{
|
|
66
66
|
type: "button",
|
|
67
67
|
disabled: !c,
|
|
68
68
|
onClick: () => {
|
|
69
|
-
|
|
69
|
+
P(e.room, e.label), d(!1);
|
|
70
70
|
},
|
|
71
71
|
className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] hover:bg-slate-50 disabled:cursor-default disabled:hover:bg-transparent dark:hover:bg-slate-800",
|
|
72
72
|
children: [
|
|
@@ -82,7 +82,7 @@ function G({
|
|
|
82
82
|
" new"
|
|
83
83
|
] }) : /* @__PURE__ */ r(f, { children: [
|
|
84
84
|
/* @__PURE__ */ r("span", { className: "shrink-0 text-[11px] text-slate-500 tabular-nums dark:text-slate-400", children: [
|
|
85
|
-
e.count,
|
|
85
|
+
$(e.count),
|
|
86
86
|
" ",
|
|
87
87
|
e.count === 1 ? "message" : "messages"
|
|
88
88
|
] }),
|
|
@@ -98,6 +98,6 @@ function G({
|
|
|
98
98
|
] });
|
|
99
99
|
}
|
|
100
100
|
export {
|
|
101
|
-
|
|
101
|
+
H as RecordChatMentionsChip,
|
|
102
102
|
o as mentionsText
|
|
103
103
|
};
|