@nivaro/react 0.3.40 → 0.3.42
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/LayoutForm.js +100 -98
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +645 -16
- package/dist/index.js +814 -775
- package/dist/shared/components/ActivityEntry.js +154 -0
- package/dist/shared/components/AudienceConfirmPanel.js +98 -0
- package/dist/shared/components/BackgroundRunOffer.js +43 -31
- package/dist/shared/components/BroadcastView.js +225 -204
- package/dist/shared/components/CollectionBrowserView.js +3924 -3584
- package/dist/shared/components/ConfigHistory.js +153 -0
- package/dist/shared/components/ConfigReadBack.js +65 -0
- package/dist/shared/components/DataTable.js +379 -346
- package/dist/shared/components/ForceReloadBanner.js +47 -40
- package/dist/shared/components/IdleReloadWatcher.js +69 -0
- package/dist/shared/components/ItemEditForm.js +4041 -3853
- package/dist/shared/components/MyWorkView.js +278 -213
- package/dist/shared/components/NotificationBell.js +130 -121
- package/dist/shared/components/PickerExcludedRows.js +3 -3
- package/dist/shared/components/ProfileView.js +776 -1003
- package/dist/shared/components/RecentRecordsRail.js +34 -16
- package/dist/shared/components/RecordReadView.js +500 -477
- package/dist/shared/components/Skeletons.js +199 -0
- package/dist/shared/components/SlowNotice.js +63 -0
- package/dist/shared/components/Term.js +23 -0
- package/dist/shared/components/WidgetSlot.js +350 -353
- package/dist/shared/components/access/PermissionSummary.js +106 -0
- package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
- package/dist/shared/components/chat/ChatPanel.js +902 -886
- package/dist/shared/components/chat/MemberPaging.js +70 -0
- package/dist/shared/components/chat/RoomParts.js +147 -117
- package/dist/shared/components/chat/ScreenClip.js +73 -69
- package/dist/shared/components/chat/chat-core.js +449 -396
- package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
- package/dist/shared/components/help-videos/api.js +2 -5
- package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
- package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
- package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
- package/dist/shared/components/imports/RunDetailSheet.js +222 -227
- package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
- package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
- package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
- package/dist/shared/components/item-edit/FieldComments.js +212 -0
- package/dist/shared/components/item-edit/FieldRow.js +340 -336
- package/dist/shared/components/item-edit/RecordGrantTools.js +28 -28
- package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
- package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
- package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
- package/dist/shared/components/item-edit/field-comments-context.js +6 -0
- package/dist/shared/components/item-edit/field-sources.js +33 -0
- package/dist/shared/components/item-edit/rule-hidden.js +30 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
- package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
- package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/settings-registry.js +1 -1
- package/dist/shared/components/list/CopyListLinkButton.js +41 -0
- package/dist/shared/components/list/InlineEdit.js +363 -0
- package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
- package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
- package/dist/shared/components/notifications/TestMyRules.js +137 -0
- package/dist/shared/components/notifications/changes-lines.js +24 -0
- package/dist/shared/components/notifications/why-lines.js +64 -0
- package/dist/shared/components/panels/CommentPanel.js +316 -281
- package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
- package/dist/shared/components/panels/PipelinePanel.js +201 -196
- package/dist/shared/components/panels/RevisionsPanel.js +496 -479
- package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
- package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
- package/dist/shared/components/profile/PersonDidPanel.js +188 -0
- package/dist/shared/components/profile/PersonProfile.js +57 -52
- package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
- package/dist/shared/hooks/useSlowReason.js +39 -0
- package/dist/shared/lib/activity-sentence.js +670 -0
- package/dist/shared/lib/config-sentences.js +418 -0
- package/dist/shared/lib/core-glossary.js +229 -0
- package/dist/shared/lib/error-hints.js +159 -0
- package/dist/shared/lib/error-message.js +105 -0
- package/dist/shared/lib/error-toast.js +22 -0
- package/dist/shared/lib/field-comments.js +25 -0
- package/dist/shared/lib/filter-sentence.js +261 -0
- package/dist/shared/lib/glossary.js +55 -48
- package/dist/shared/lib/idle-reload.js +138 -0
- package/dist/shared/lib/layout-resolve.js +42 -29
- package/dist/shared/lib/list-inline-edit.js +190 -0
- package/dist/shared/lib/list-link.js +147 -0
- package/dist/shared/lib/prefetch.js +259 -106
- package/dist/shared/lib/record-ref.js +72 -0
- package/dist/shared/lib/reload-holds.js +25 -0
- package/dist/shared/lib/safe-error.js +52 -24
- package/dist/shared/lib/skeleton-shapes.js +72 -0
- package/dist/shared/lib/slow-reason.js +63 -0
- package/package.json +1 -1
|
@@ -1,90 +1,91 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { AlertTriangle as
|
|
4
|
-
import { useState as P, useRef as
|
|
5
|
-
import { useApiFetchConfig as
|
|
6
|
-
import { useDebounced as
|
|
7
|
-
import { PRETEND_DOWN_EVENT as
|
|
8
|
-
import { get as
|
|
9
|
-
import { HEADER_CELL_DENSE as
|
|
10
|
-
import { loadErrorText as
|
|
11
|
-
import { affixesFor as ae, formatWidgetValue as
|
|
12
|
-
import { BackgroundRunOffer as
|
|
13
|
-
import { cacheStampTip as
|
|
14
|
-
import { useStagedRelations as
|
|
15
|
-
import { LoadErrorNote as
|
|
16
|
-
import { QueryTable as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
1
|
+
import { jsx as t, jsxs as x, Fragment as we } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as Xe, useQuery as Ye } from "@tanstack/react-query";
|
|
3
|
+
import { AlertTriangle as Je, RefreshCw as ze, MoreVertical as Ze, MoreHorizontal as et, Clipboard as tt, Copy as rt, Clock as nt, Calendar as lt, Paperclip as it, Folder as at, File as st, FileText as ot, Bell as ct, Phone as dt, MessageSquare as ut, Mail as ft, UserCheck as pt, UserPlus as mt, Users as ht, User as gt, Activity as yt, Zap as xt, Power as bt, Search as wt, Filter as vt, Sliders as _t, Settings as Nt, RotateCcw as kt, Pause as St, Play as Rt, HelpCircle as Lt, Info as $t, AlertCircle as Ct, Flag as Et, Bookmark as Tt, Heart as jt, Star as Ot, Unlock as It, Lock as Dt, EyeOff as qt, Eye as Ut, Send as At, Upload as Pt, Download as Wt, Save as Mt, Trash2 as Bt, Edit2 as Ht, Edit as Vt, Minus as Ft, Plus as Jt, XCircle as zt, X as Kt, CheckCircle as Qt, Check as Gt, Share2 as Xt, Link as Yt, ExternalLink as Zt, ArrowUpRight as er, ArrowDown as tr, ArrowUp as rr, ArrowLeft as nr, ArrowRight as lr } from "lucide-react";
|
|
4
|
+
import { useState as P, useRef as ie, useCallback as De, useEffect as Y, useMemo as qe } from "react";
|
|
5
|
+
import { useApiFetchConfig as ve, useDrilldown as ir, useOptionalNivaroClient as ar } from "../context.js";
|
|
6
|
+
import { useDebounced as sr } from "../hooks/useDebounced.js";
|
|
7
|
+
import { PRETEND_DOWN_EVENT as Ue } from "../lib/client-chaos.js";
|
|
8
|
+
import { get as or, post as cr } from "../lib/commands.js";
|
|
9
|
+
import { HEADER_CELL_DENSE as dr, HEADER_CELL_LIST as ur, HEADER_LABEL as fr, HEADER_VALUE_LINE as pr, HEADER_VALUE_HERO as mr, HEADER_VALUE as hr } from "../lib/header-strip.js";
|
|
10
|
+
import { loadErrorText as Ae } from "../lib/load-error.js";
|
|
11
|
+
import { affixesFor as ae, formatWidgetValue as se } from "../lib/widget-value-format.js";
|
|
12
|
+
import { BackgroundRunOffer as gr } from "./BackgroundRunOffer.js";
|
|
13
|
+
import { cacheStampTip as yr, CacheStamp as xr } from "./CacheStamp.js";
|
|
14
|
+
import { useStagedRelations as br } from "./item-edit/O2MStagingContext.js";
|
|
15
|
+
import { LoadErrorNote as Pe } from "./LoadErrorNote.js";
|
|
16
|
+
import { QueryTable as wr } from "./QueryTable.js";
|
|
17
|
+
import { CardSkeleton as he } from "./Skeletons.js";
|
|
18
|
+
import { Button as le } from "./ui/button.js";
|
|
19
|
+
import { DropdownMenu as We, DropdownMenuTrigger as Me, DropdownMenuContent as Be, DropdownMenuItem as He } from "./ui/dropdown-menu.js";
|
|
20
|
+
import { reportSlotScalar as vr, ReportSlotWidget as _r } from "./widgets/ReportSlotWidget.js";
|
|
21
|
+
import { ReviewListWidget as Nr } from "./widgets/ReviewListWidget.js";
|
|
22
|
+
import { RollupWidget as kr } from "./widgets/RollupWidget.js";
|
|
22
23
|
const Q = {
|
|
23
|
-
ArrowRight:
|
|
24
|
-
ArrowLeft:
|
|
25
|
-
ArrowUp:
|
|
26
|
-
ArrowDown:
|
|
27
|
-
ArrowUpRight:
|
|
28
|
-
ExternalLink:
|
|
29
|
-
Link:
|
|
30
|
-
Share2:
|
|
31
|
-
Check:
|
|
32
|
-
CheckCircle:
|
|
33
|
-
X:
|
|
34
|
-
XCircle:
|
|
35
|
-
Plus:
|
|
36
|
-
Minus:
|
|
37
|
-
Edit:
|
|
38
|
-
Edit2:
|
|
39
|
-
Trash2:
|
|
40
|
-
Save:
|
|
41
|
-
Download:
|
|
42
|
-
Upload:
|
|
43
|
-
Send:
|
|
44
|
-
Eye:
|
|
45
|
-
EyeOff:
|
|
46
|
-
Lock:
|
|
47
|
-
Unlock:
|
|
48
|
-
Star:
|
|
49
|
-
Heart:
|
|
50
|
-
Bookmark:
|
|
51
|
-
Flag:
|
|
52
|
-
AlertCircle:
|
|
53
|
-
AlertTriangle:
|
|
54
|
-
Info:
|
|
55
|
-
HelpCircle:
|
|
56
|
-
Play:
|
|
57
|
-
Pause:
|
|
58
|
-
RefreshCw:
|
|
59
|
-
RotateCcw:
|
|
60
|
-
Settings:
|
|
61
|
-
Sliders:
|
|
62
|
-
Filter:
|
|
63
|
-
Search:
|
|
64
|
-
Power:
|
|
65
|
-
Zap:
|
|
66
|
-
Activity:
|
|
67
|
-
User:
|
|
68
|
-
Users:
|
|
69
|
-
UserPlus:
|
|
70
|
-
UserCheck:
|
|
71
|
-
Mail:
|
|
72
|
-
MessageSquare:
|
|
73
|
-
Phone:
|
|
74
|
-
Bell:
|
|
75
|
-
FileText:
|
|
76
|
-
File:
|
|
77
|
-
Folder:
|
|
78
|
-
Paperclip:
|
|
79
|
-
Calendar:
|
|
80
|
-
Clock:
|
|
81
|
-
Copy:
|
|
82
|
-
Clipboard:
|
|
83
|
-
MoreHorizontal:
|
|
84
|
-
MoreVertical:
|
|
24
|
+
ArrowRight: lr,
|
|
25
|
+
ArrowLeft: nr,
|
|
26
|
+
ArrowUp: rr,
|
|
27
|
+
ArrowDown: tr,
|
|
28
|
+
ArrowUpRight: er,
|
|
29
|
+
ExternalLink: Zt,
|
|
30
|
+
Link: Yt,
|
|
31
|
+
Share2: Xt,
|
|
32
|
+
Check: Gt,
|
|
33
|
+
CheckCircle: Qt,
|
|
34
|
+
X: Kt,
|
|
35
|
+
XCircle: zt,
|
|
36
|
+
Plus: Jt,
|
|
37
|
+
Minus: Ft,
|
|
38
|
+
Edit: Vt,
|
|
39
|
+
Edit2: Ht,
|
|
40
|
+
Trash2: Bt,
|
|
41
|
+
Save: Mt,
|
|
42
|
+
Download: Wt,
|
|
43
|
+
Upload: Pt,
|
|
44
|
+
Send: At,
|
|
45
|
+
Eye: Ut,
|
|
46
|
+
EyeOff: qt,
|
|
47
|
+
Lock: Dt,
|
|
48
|
+
Unlock: It,
|
|
49
|
+
Star: Ot,
|
|
50
|
+
Heart: jt,
|
|
51
|
+
Bookmark: Tt,
|
|
52
|
+
Flag: Et,
|
|
53
|
+
AlertCircle: Ct,
|
|
54
|
+
AlertTriangle: Je,
|
|
55
|
+
Info: $t,
|
|
56
|
+
HelpCircle: Lt,
|
|
57
|
+
Play: Rt,
|
|
58
|
+
Pause: St,
|
|
59
|
+
RefreshCw: ze,
|
|
60
|
+
RotateCcw: kt,
|
|
61
|
+
Settings: Nt,
|
|
62
|
+
Sliders: _t,
|
|
63
|
+
Filter: vt,
|
|
64
|
+
Search: wt,
|
|
65
|
+
Power: bt,
|
|
66
|
+
Zap: xt,
|
|
67
|
+
Activity: yt,
|
|
68
|
+
User: gt,
|
|
69
|
+
Users: ht,
|
|
70
|
+
UserPlus: mt,
|
|
71
|
+
UserCheck: pt,
|
|
72
|
+
Mail: ft,
|
|
73
|
+
MessageSquare: ut,
|
|
74
|
+
Phone: dt,
|
|
75
|
+
Bell: ct,
|
|
76
|
+
FileText: ot,
|
|
77
|
+
File: st,
|
|
78
|
+
Folder: at,
|
|
79
|
+
Paperclip: it,
|
|
80
|
+
Calendar: lt,
|
|
81
|
+
Clock: nt,
|
|
82
|
+
Copy: rt,
|
|
83
|
+
Clipboard: tt,
|
|
84
|
+
MoreHorizontal: et,
|
|
85
|
+
MoreVertical: Ze
|
|
85
86
|
};
|
|
86
|
-
function
|
|
87
|
-
return /* @__PURE__ */
|
|
87
|
+
function _e({ awaiting: l, dark: s }) {
|
|
88
|
+
return /* @__PURE__ */ x(
|
|
88
89
|
"span",
|
|
89
90
|
{
|
|
90
91
|
className: `text-[12px] font-normal italic ${s ? "text-slate-400" : "text-slate-400 dark:text-slate-500"}`,
|
|
@@ -97,35 +98,35 @@ function xe({ awaiting: l, dark: s }) {
|
|
|
97
98
|
}
|
|
98
99
|
);
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function ge({
|
|
101
102
|
label: l,
|
|
102
103
|
value: s,
|
|
103
104
|
display: o,
|
|
104
|
-
loading:
|
|
105
|
+
loading: i,
|
|
105
106
|
awaiting: c
|
|
106
107
|
}) {
|
|
107
|
-
const { prefix: m, suffix: v } = ae(s, o),
|
|
108
|
+
const { prefix: m, suffix: v } = ae(s, o), b = i ? null : se(s, o.format ?? "");
|
|
108
109
|
return (
|
|
109
110
|
// Same label / value vocabulary as a field tile in the record sub-header
|
|
110
111
|
// (lib/header-strip.ts) — the two kinds of cell read as one row.
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ x(
|
|
112
113
|
"div",
|
|
113
114
|
{
|
|
114
|
-
className: `flex h-full min-w-0 flex-col justify-start gap-1 px-4 pt-[9px] pb-2 ${
|
|
115
|
+
className: `flex h-full min-w-0 flex-col justify-start gap-1 px-4 pt-[9px] pb-2 ${dr} ${ur}`,
|
|
115
116
|
children: [
|
|
116
|
-
/* @__PURE__ */ t("span", { className:
|
|
117
|
+
/* @__PURE__ */ t("span", { className: fr, "data-header-label": !0, children: l }),
|
|
117
118
|
/* @__PURE__ */ t(
|
|
118
119
|
"span",
|
|
119
120
|
{
|
|
120
121
|
"data-header-value": !0,
|
|
121
|
-
className: `${
|
|
122
|
-
children:
|
|
122
|
+
className: `${pr} max-w-[232px] items-baseline truncate leading-tight`,
|
|
123
|
+
children: i ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : c && s == null ? /* @__PURE__ */ t(_e, { awaiting: c }) : /* @__PURE__ */ x(
|
|
123
124
|
"span",
|
|
124
125
|
{
|
|
125
|
-
className: String(o.format ?? "").startsWith("currency") || /^[$€£¥]/.test(m) ?
|
|
126
|
+
className: String(o.format ?? "").startsWith("currency") || /^[$€£¥]/.test(m) ? mr : hr,
|
|
126
127
|
children: [
|
|
127
128
|
m,
|
|
128
|
-
|
|
129
|
+
b,
|
|
129
130
|
v
|
|
130
131
|
]
|
|
131
132
|
}
|
|
@@ -137,18 +138,18 @@ function me({
|
|
|
137
138
|
)
|
|
138
139
|
);
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
+
function Sr({
|
|
141
142
|
data: l,
|
|
142
143
|
label: s,
|
|
143
144
|
loading: o,
|
|
144
|
-
widgetConfig:
|
|
145
|
+
widgetConfig: i,
|
|
145
146
|
awaiting: c
|
|
146
147
|
}) {
|
|
147
148
|
const m = "h-full flex items-stretch divide-x divide-slate-200 dark:divide-border [[data-header-list]_&]:w-full [[data-header-list]_&]:flex-col [[data-header-list]_&]:divide-x-0";
|
|
148
149
|
if (l && "values" in l) {
|
|
149
|
-
const
|
|
150
|
-
return
|
|
151
|
-
|
|
150
|
+
const b = l.values ?? [];
|
|
151
|
+
return b.length === 0 ? null : /* @__PURE__ */ t("div", { className: m, children: b.map((_, R) => /* @__PURE__ */ t(
|
|
152
|
+
ge,
|
|
152
153
|
{
|
|
153
154
|
label: _.label,
|
|
154
155
|
value: _.value,
|
|
@@ -160,9 +161,9 @@ function Nr({
|
|
|
160
161
|
)) });
|
|
161
162
|
}
|
|
162
163
|
if (o) {
|
|
163
|
-
const
|
|
164
|
+
const b = (i == null ? void 0 : i.value_fields) ?? [], _ = b.length > 0 ? b : [{ label: s }];
|
|
164
165
|
return /* @__PURE__ */ t("div", { className: m, children: _.map((R, $) => /* @__PURE__ */ t(
|
|
165
|
-
|
|
166
|
+
ge,
|
|
166
167
|
{
|
|
167
168
|
label: R.label ?? s,
|
|
168
169
|
display: { prefix: R.prefix ?? "", suffix: R.suffix ?? "", format: R.format ?? "" },
|
|
@@ -174,7 +175,7 @@ function Nr({
|
|
|
174
175
|
if (!l) return null;
|
|
175
176
|
const v = l.display ?? {};
|
|
176
177
|
return /* @__PURE__ */ t("div", { className: m, children: /* @__PURE__ */ t(
|
|
177
|
-
|
|
178
|
+
ge,
|
|
178
179
|
{
|
|
179
180
|
label: s,
|
|
180
181
|
value: l.value,
|
|
@@ -184,89 +185,89 @@ function Nr({
|
|
|
184
185
|
}
|
|
185
186
|
) });
|
|
186
187
|
}
|
|
187
|
-
function
|
|
188
|
+
function Rr(l, s) {
|
|
188
189
|
if (Object.hasOwn(l, s)) return l[s] ?? null;
|
|
189
190
|
const o = s.split(".");
|
|
190
|
-
let
|
|
191
|
+
let i = l;
|
|
191
192
|
for (const c of o) {
|
|
192
|
-
if (
|
|
193
|
-
|
|
193
|
+
if (i == null || typeof i != "object") return i ?? null;
|
|
194
|
+
i = i[c];
|
|
194
195
|
}
|
|
195
|
-
return
|
|
196
|
+
return i ?? null;
|
|
196
197
|
}
|
|
197
|
-
function
|
|
198
|
+
function Lr(l, s) {
|
|
198
199
|
const o = {};
|
|
199
|
-
for (const
|
|
200
|
-
if (
|
|
201
|
-
o[
|
|
202
|
-
else if (
|
|
203
|
-
o[
|
|
204
|
-
else if (
|
|
200
|
+
for (const i of l)
|
|
201
|
+
if (i.binding_type === "item_field")
|
|
202
|
+
o[i.key] = Rr(s, i.binding_value);
|
|
203
|
+
else if (i.binding_type === "static")
|
|
204
|
+
o[i.key] = i.binding_value;
|
|
205
|
+
else if (i.binding_type === "url_param" && typeof window < "u") {
|
|
205
206
|
const c = new URLSearchParams(window.location.search);
|
|
206
|
-
o[
|
|
207
|
+
o[i.key] = c.get(i.binding_value) ?? null;
|
|
207
208
|
}
|
|
208
209
|
return o;
|
|
209
210
|
}
|
|
210
|
-
function
|
|
211
|
+
function ye({
|
|
211
212
|
data: l,
|
|
212
213
|
awaiting: s
|
|
213
214
|
}) {
|
|
214
|
-
if (s && l.value == null) return /* @__PURE__ */ t(
|
|
215
|
-
const o = l.display ?? {}, { prefix:
|
|
216
|
-
return /* @__PURE__ */
|
|
217
|
-
|
|
215
|
+
if (s && l.value == null) return /* @__PURE__ */ t(_e, { awaiting: s });
|
|
216
|
+
const o = l.display ?? {}, { prefix: i, suffix: c } = ae(l.value, o), m = se(l.value, o.format ?? "");
|
|
217
|
+
return /* @__PURE__ */ x("div", { className: "flex items-baseline gap-1", children: [
|
|
218
|
+
i && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: i }),
|
|
218
219
|
/* @__PURE__ */ t("span", { className: "text-2xl font-semibold text-slate-900 dark:text-slate-100", children: m }),
|
|
219
220
|
c && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: c })
|
|
220
221
|
] });
|
|
221
222
|
}
|
|
222
|
-
function
|
|
223
|
+
function xe({
|
|
223
224
|
label: l,
|
|
224
225
|
value: s,
|
|
225
226
|
display: o,
|
|
226
|
-
dark:
|
|
227
|
+
dark: i,
|
|
227
228
|
loading: c,
|
|
228
229
|
awaiting: m
|
|
229
230
|
}) {
|
|
230
|
-
const { prefix: v, suffix:
|
|
231
|
-
return /* @__PURE__ */
|
|
231
|
+
const { prefix: v, suffix: b } = ae(s, o), _ = c ? null : se(s, o.format ?? "");
|
|
232
|
+
return /* @__PURE__ */ x("div", { className: "flex flex-col justify-center px-2.5 py-1 min-w-0 gap-0.5", children: [
|
|
232
233
|
/* @__PURE__ */ t(
|
|
233
234
|
"span",
|
|
234
235
|
{
|
|
235
|
-
className: `text-[9px] font-medium uppercase tracking-wider leading-none truncate ${
|
|
236
|
+
className: `text-[9px] font-medium uppercase tracking-wider leading-none truncate ${i ? "text-slate-500" : "text-slate-400"}`,
|
|
236
237
|
children: l
|
|
237
238
|
}
|
|
238
239
|
),
|
|
239
240
|
/* @__PURE__ */ t(
|
|
240
241
|
"span",
|
|
241
242
|
{
|
|
242
|
-
className: `flex items-baseline gap-0.5 text-[13px] font-semibold tabular-nums leading-none ${
|
|
243
|
+
className: `flex items-baseline gap-0.5 text-[13px] font-semibold tabular-nums leading-none ${i ? "text-slate-100" : "text-slate-900"}`,
|
|
243
244
|
children: c ? /* @__PURE__ */ t(
|
|
244
245
|
"span",
|
|
245
246
|
{
|
|
246
|
-
className: `animate-pulse inline-block h-3 w-14 rounded ${
|
|
247
|
+
className: `animate-pulse inline-block h-3 w-14 rounded ${i ? "bg-slate-600" : "bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]"}`
|
|
247
248
|
}
|
|
248
|
-
) : m && s == null ? /* @__PURE__ */ t(
|
|
249
|
-
v && /* @__PURE__ */ t("span", { className: `text-[10px] ${
|
|
249
|
+
) : m && s == null ? /* @__PURE__ */ t(_e, { awaiting: m, dark: i }) : /* @__PURE__ */ x(we, { children: [
|
|
250
|
+
v && /* @__PURE__ */ t("span", { className: `text-[10px] ${i ? "text-slate-400" : "text-slate-500"}`, children: v }),
|
|
250
251
|
_,
|
|
251
|
-
|
|
252
|
+
b && /* @__PURE__ */ t("span", { className: `text-[10px] ${i ? "text-slate-400" : "text-slate-500"}`, children: b })
|
|
252
253
|
] })
|
|
253
254
|
}
|
|
254
255
|
)
|
|
255
256
|
] });
|
|
256
257
|
}
|
|
257
|
-
function
|
|
258
|
+
function $r({
|
|
258
259
|
data: l,
|
|
259
260
|
label: s,
|
|
260
261
|
style: o,
|
|
261
|
-
loading:
|
|
262
|
+
loading: i,
|
|
262
263
|
widgetConfig: c,
|
|
263
264
|
awaiting: m
|
|
264
265
|
}) {
|
|
265
|
-
const v = o === "pill-dark",
|
|
266
|
+
const v = o === "pill-dark", b = v ? "flex items-stretch divide-x divide-slate-700 rounded-md bg-slate-800/90 border border-slate-700 overflow-hidden" : "flex items-stretch divide-x divide-slate-200 rounded-md bg-white border border-slate-200 overflow-hidden dark:bg-card dark:border-border dark:divide-border";
|
|
266
267
|
if (l && "values" in l) {
|
|
267
268
|
const R = l.values ?? [];
|
|
268
|
-
return R.length === 0 ? null : /* @__PURE__ */ t("div", { className:
|
|
269
|
-
|
|
269
|
+
return R.length === 0 ? null : /* @__PURE__ */ t("div", { className: b, children: R.map(($, k) => /* @__PURE__ */ t(
|
|
270
|
+
xe,
|
|
270
271
|
{
|
|
271
272
|
label: $.label,
|
|
272
273
|
value: $.value,
|
|
@@ -278,10 +279,10 @@ function Rr({
|
|
|
278
279
|
k
|
|
279
280
|
)) });
|
|
280
281
|
}
|
|
281
|
-
if (
|
|
282
|
+
if (i) {
|
|
282
283
|
const R = (c == null ? void 0 : c.value_fields) ?? [], $ = R.length > 0 ? R : [{ label: s }];
|
|
283
|
-
return /* @__PURE__ */ t("div", { className:
|
|
284
|
-
|
|
284
|
+
return /* @__PURE__ */ t("div", { className: b, children: $.map((k, U) => /* @__PURE__ */ t(
|
|
285
|
+
xe,
|
|
285
286
|
{
|
|
286
287
|
label: k.label ?? s,
|
|
287
288
|
display: { prefix: k.prefix ?? "", suffix: k.suffix ?? "", format: k.format ?? "" },
|
|
@@ -293,8 +294,8 @@ function Rr({
|
|
|
293
294
|
}
|
|
294
295
|
if (!l) return null;
|
|
295
296
|
const _ = l.display ?? {};
|
|
296
|
-
return /* @__PURE__ */ t("div", { className:
|
|
297
|
-
|
|
297
|
+
return /* @__PURE__ */ t("div", { className: b, children: /* @__PURE__ */ t(
|
|
298
|
+
xe,
|
|
298
299
|
{
|
|
299
300
|
label: s,
|
|
300
301
|
value: l.value,
|
|
@@ -305,46 +306,46 @@ function Rr({
|
|
|
305
306
|
}
|
|
306
307
|
) });
|
|
307
308
|
}
|
|
308
|
-
function
|
|
309
|
+
function Ve({ data: l }) {
|
|
309
310
|
const s = l.values ?? [];
|
|
310
311
|
return s.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No values" }) : /* @__PURE__ */ t(
|
|
311
312
|
"div",
|
|
312
313
|
{
|
|
313
314
|
className: "grid gap-3",
|
|
314
315
|
style: { gridTemplateColumns: `repeat(${Math.min(s.length, 3)}, minmax(0, 1fr))` },
|
|
315
|
-
children: s.map((o,
|
|
316
|
-
var
|
|
317
|
-
const { prefix: c, suffix: m } = ae(o.value, o.display), v = ((
|
|
318
|
-
return /* @__PURE__ */
|
|
316
|
+
children: s.map((o, i) => {
|
|
317
|
+
var b;
|
|
318
|
+
const { prefix: c, suffix: m } = ae(o.value, o.display), v = ((b = o.display) == null ? void 0 : b.format) ?? "";
|
|
319
|
+
return /* @__PURE__ */ x("div", { className: "flex flex-col gap-0.5", children: [
|
|
319
320
|
o.label && /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: o.label }),
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ x("div", { className: "flex items-baseline gap-0.5", children: [
|
|
321
322
|
c && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: c }),
|
|
322
|
-
/* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children:
|
|
323
|
+
/* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children: se(o.value, v) }),
|
|
323
324
|
m && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: m })
|
|
324
325
|
] })
|
|
325
|
-
] },
|
|
326
|
+
] }, i);
|
|
326
327
|
})
|
|
327
328
|
}
|
|
328
329
|
);
|
|
329
330
|
}
|
|
330
|
-
function
|
|
331
|
+
function Cr({ data: l }) {
|
|
331
332
|
const s = l.rows ?? [], o = l.fields ?? [];
|
|
332
|
-
return s.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No items" }) : /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */
|
|
333
|
-
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children: o.map((
|
|
334
|
-
/* @__PURE__ */ t("tbody", { children: s.map((
|
|
333
|
+
return s.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No items" }) : /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ x("table", { className: "w-full text-[12px]", children: [
|
|
334
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children: o.map((i) => /* @__PURE__ */ t("th", { className: "py-1 pr-3 text-left font-medium text-slate-500", children: i }, i)) }) }),
|
|
335
|
+
/* @__PURE__ */ t("tbody", { children: s.map((i, c) => /* @__PURE__ */ t("tr", { className: "border-b border-slate-50", children: o.map((m) => /* @__PURE__ */ t("td", { className: "py-1 pr-3 text-slate-700", children: String(i[m] ?? "") }, m)) }, c)) })
|
|
335
336
|
] }) });
|
|
336
337
|
}
|
|
337
|
-
function
|
|
338
|
+
function Fe({
|
|
338
339
|
data: l,
|
|
339
340
|
widgetId: s,
|
|
340
341
|
inputs: o,
|
|
341
|
-
apiBase:
|
|
342
|
+
apiBase: i,
|
|
342
343
|
onAction: c
|
|
343
344
|
}) {
|
|
344
|
-
const m = l.buttons ?? [], [v,
|
|
345
|
-
|
|
345
|
+
const m = l.buttons ?? [], [v, b] = P(null), _ = ve(), R = async ($) => {
|
|
346
|
+
b($);
|
|
346
347
|
try {
|
|
347
|
-
const k = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", C = (await (await fetch(`${
|
|
348
|
+
const k = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", C = (await (await fetch(`${i}/widgets-internal/${s}/action`, {
|
|
348
349
|
method: "POST",
|
|
349
350
|
headers: {
|
|
350
351
|
"Content-Type": "application/json",
|
|
@@ -362,7 +363,7 @@ function He({
|
|
|
362
363
|
}
|
|
363
364
|
c == null || c(C);
|
|
364
365
|
} finally {
|
|
365
|
-
|
|
366
|
+
b(null);
|
|
366
367
|
}
|
|
367
368
|
};
|
|
368
369
|
return /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: m.map(($, k) => {
|
|
@@ -380,50 +381,50 @@ function He({
|
|
|
380
381
|
);
|
|
381
382
|
}) });
|
|
382
383
|
}
|
|
383
|
-
const
|
|
384
|
-
function
|
|
384
|
+
const Er = /* @__PURE__ */ new Set(["navigate", "field-update", "flow", "toggle"]);
|
|
385
|
+
function be({
|
|
385
386
|
buttons: l,
|
|
386
387
|
layout: s,
|
|
387
388
|
widgetId: o,
|
|
388
|
-
inputs:
|
|
389
|
+
inputs: i,
|
|
389
390
|
apiBase: c,
|
|
390
391
|
onClientAction: m
|
|
391
392
|
}) {
|
|
392
|
-
const [v,
|
|
393
|
+
const [v, b] = P(null), [_, R] = P(null), [$, k] = P({}), U = ie(null), q = ve();
|
|
393
394
|
function C(e) {
|
|
394
395
|
return e === !0 || e === 1 ? "1" : e === !1 || e === 0 ? "0" : String(e ?? "");
|
|
395
396
|
}
|
|
396
|
-
function E(e,
|
|
397
|
-
const u = e.id ?? String(
|
|
398
|
-
return $[u] !== void 0 ? $[u] : e.is_on !== void 0 ? e.is_on : C(
|
|
397
|
+
function E(e, f) {
|
|
398
|
+
const u = e.id ?? String(f);
|
|
399
|
+
return $[u] !== void 0 ? $[u] : e.is_on !== void 0 ? e.is_on : C(i[e.toggle_input ?? ""]) === C(e.toggle_on_value ?? "1");
|
|
399
400
|
}
|
|
400
|
-
function G(e,
|
|
401
|
-
if (e.action !== "toggle") return e.label ?? `Action ${
|
|
402
|
-
const u = e.action_config,
|
|
403
|
-
return E(
|
|
401
|
+
function G(e, f) {
|
|
402
|
+
if (e.action !== "toggle") return e.label ?? `Action ${f + 1}`;
|
|
403
|
+
const u = e.action_config, p = e.toggle_input || (u == null ? void 0 : u.toggle_input) || (u == null ? void 0 : u.field) || "", T = p && p !== e.toggle_input ? { ...e, toggle_input: p } : e;
|
|
404
|
+
return E(T, f) ? e.label_on || e.label || `Action ${f + 1}` : e.label_off || e.label || `Action ${f + 1}`;
|
|
404
405
|
}
|
|
405
|
-
function
|
|
406
|
+
function oe(e) {
|
|
406
407
|
try {
|
|
407
408
|
if (e.startsWith("/") && !e.startsWith("//")) return e;
|
|
408
|
-
const
|
|
409
|
-
return ["http:", "https:"].includes(
|
|
409
|
+
const f = new URL(e, window.location.origin);
|
|
410
|
+
return ["http:", "https:"].includes(f.protocol) ? f.toString() : null;
|
|
410
411
|
} catch {
|
|
411
412
|
return null;
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
|
-
async function r(e,
|
|
415
|
-
const u = e.id ?? String(
|
|
415
|
+
async function r(e, f) {
|
|
416
|
+
const u = e.id ?? String(f);
|
|
416
417
|
R(u);
|
|
417
418
|
try {
|
|
418
|
-
const
|
|
419
|
+
const p = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", g = (await (await fetch(`${c}/widgets-internal/${o}/action`, {
|
|
419
420
|
method: "POST",
|
|
420
421
|
headers: {
|
|
421
422
|
"Content-Type": "application/json",
|
|
422
423
|
...q.authHeaders,
|
|
423
|
-
...
|
|
424
|
+
...p ? { "x-workspace": p } : {}
|
|
424
425
|
},
|
|
425
426
|
credentials: q.credentials,
|
|
426
|
-
body: JSON.stringify({ button_index:
|
|
427
|
+
body: JSON.stringify({ button_index: f, inputs: i })
|
|
427
428
|
})).json()).data;
|
|
428
429
|
if (g != null && g.redirect_url)
|
|
429
430
|
try {
|
|
@@ -435,27 +436,27 @@ function ye({
|
|
|
435
436
|
R(null);
|
|
436
437
|
}
|
|
437
438
|
}
|
|
438
|
-
function z(e,
|
|
439
|
+
function z(e, f) {
|
|
439
440
|
const u = e.action ?? "open-url";
|
|
440
|
-
if (
|
|
441
|
+
if (Er.has(u)) {
|
|
441
442
|
if (u === "toggle") {
|
|
442
|
-
const
|
|
443
|
-
k((
|
|
443
|
+
const p = e.id ?? String(f);
|
|
444
|
+
k((T) => ({ ...T, [p]: !E(e, f) }));
|
|
444
445
|
}
|
|
445
|
-
r(e,
|
|
446
|
+
r(e, f);
|
|
446
447
|
return;
|
|
447
448
|
}
|
|
448
449
|
if (u === "open-url" && e.url) {
|
|
449
|
-
const
|
|
450
|
-
if (!
|
|
451
|
-
e.new_tab ? window.open(
|
|
450
|
+
const p = oe(e.url);
|
|
451
|
+
if (!p) return;
|
|
452
|
+
e.new_tab ? window.open(p, "_blank", "noopener,noreferrer") : window.location.href = p;
|
|
452
453
|
} else if (u === "email") {
|
|
453
|
-
const
|
|
454
|
-
e.email_subject &&
|
|
454
|
+
const p = [];
|
|
455
|
+
e.email_subject && p.push(`subject=${encodeURIComponent(e.email_subject)}`), e.email_body && p.push(`body=${encodeURIComponent(e.email_body)}`), window.location.href = `mailto:${e.email_to ?? ""}${p.length ? `?${p.join("&")}` : ""}`;
|
|
455
456
|
} else if (u === "copy") {
|
|
456
|
-
const
|
|
457
|
-
navigator.clipboard.writeText(
|
|
458
|
-
|
|
457
|
+
const p = e.copy_value ?? "";
|
|
458
|
+
navigator.clipboard.writeText(p).then(() => {
|
|
459
|
+
b(e.id ?? String(f)), U.current && clearTimeout(U.current), U.current = setTimeout(() => b(null), 1800);
|
|
459
460
|
});
|
|
460
461
|
} else u === "open-sidebar" && e.sidebar_collection && e.sidebar_id && (m == null || m({
|
|
461
462
|
type: "open-sidebar",
|
|
@@ -463,27 +464,27 @@ function ye({
|
|
|
463
464
|
itemId: e.sidebar_id
|
|
464
465
|
}));
|
|
465
466
|
}
|
|
466
|
-
function
|
|
467
|
-
const
|
|
468
|
-
if (
|
|
469
|
-
const u = parseInt(
|
|
470
|
-
return (u * 299 +
|
|
467
|
+
function a(e) {
|
|
468
|
+
const f = e.replace("#", "");
|
|
469
|
+
if (f.length < 6) return !0;
|
|
470
|
+
const u = parseInt(f.slice(0, 2), 16), p = parseInt(f.slice(2, 4), 16), T = parseInt(f.slice(4, 6), 16);
|
|
471
|
+
return (u * 299 + p * 587 + T * 114) / 1e3 > 128;
|
|
471
472
|
}
|
|
472
|
-
function Z(e,
|
|
473
|
-
const
|
|
473
|
+
function Z(e, f, u) {
|
|
474
|
+
const p = e.id ?? String(f), T = v === p, A = _ === p;
|
|
474
475
|
let g = e.label ?? "Button", N = e.variant ?? "secondary";
|
|
475
476
|
const W = e.action_config, D = e.toggle_input || (W == null ? void 0 : W.toggle_input) || (W == null ? void 0 : W.field) || "";
|
|
476
477
|
if (e.action === "toggle") {
|
|
477
|
-
const O = D && D !== e.toggle_input ? { ...e, toggle_input: D } : e, V = E(O,
|
|
478
|
+
const O = D && D !== e.toggle_input ? { ...e, toggle_input: D } : e, V = E(O, f);
|
|
478
479
|
g = V ? e.label_on || g : e.label_off || g, N = V ? e.variant_on ?? N : e.variant_off ?? N;
|
|
479
480
|
}
|
|
480
481
|
const H = e.icon ? Q[e.icon] : null, L = e.color ? {
|
|
481
482
|
backgroundColor: e.color,
|
|
482
483
|
borderColor: e.color,
|
|
483
|
-
color:
|
|
484
|
+
color: a(e.color) ? "#1e293b" : "#ffffff"
|
|
484
485
|
} : void 0;
|
|
485
|
-
return /* @__PURE__ */
|
|
486
|
-
|
|
486
|
+
return /* @__PURE__ */ x(
|
|
487
|
+
le,
|
|
487
488
|
{
|
|
488
489
|
type: "button",
|
|
489
490
|
variant: N,
|
|
@@ -491,18 +492,18 @@ function ye({
|
|
|
491
492
|
className: "h-7 gap-1.5 text-[12px]",
|
|
492
493
|
style: L,
|
|
493
494
|
disabled: _ !== null,
|
|
494
|
-
onClick: () => z(e,
|
|
495
|
+
onClick: () => z(e, f),
|
|
495
496
|
children: [
|
|
496
497
|
H && /* @__PURE__ */ t(H, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
497
|
-
A ? "…" :
|
|
498
|
+
A ? "…" : T ? "✓ Copied" : g
|
|
498
499
|
]
|
|
499
500
|
},
|
|
500
|
-
|
|
501
|
+
p
|
|
501
502
|
);
|
|
502
503
|
}
|
|
503
504
|
if (l.length === 0) return null;
|
|
504
505
|
if (s === "split" && l.length > 1) {
|
|
505
|
-
const [e, ...
|
|
506
|
+
const [e, ...f] = l, u = e.id ?? "0", p = _ === u, T = e.action === "none" || !e.action;
|
|
506
507
|
let A = e.label ?? "Button", g = e.variant ?? "default";
|
|
507
508
|
const N = e.action_config, W = e.toggle_input || (N == null ? void 0 : N.toggle_input) || (N == null ? void 0 : N.field) || "";
|
|
508
509
|
if (e.action === "toggle" && W) {
|
|
@@ -512,11 +513,11 @@ function ye({
|
|
|
512
513
|
const D = e.icon ? Q[e.icon] : null, H = e.color ? {
|
|
513
514
|
backgroundColor: e.color,
|
|
514
515
|
borderColor: e.color,
|
|
515
|
-
color:
|
|
516
|
+
color: a(e.color) ? "#1e293b" : "#ffffff"
|
|
516
517
|
} : void 0;
|
|
517
|
-
return
|
|
518
|
-
/* @__PURE__ */ t(
|
|
519
|
-
|
|
518
|
+
return T ? /* @__PURE__ */ t("div", { className: "flex items-center", children: /* @__PURE__ */ x(We, { children: [
|
|
519
|
+
/* @__PURE__ */ t(Me, { asChild: !0, children: /* @__PURE__ */ x(
|
|
520
|
+
le,
|
|
520
521
|
{
|
|
521
522
|
type: "button",
|
|
522
523
|
variant: g,
|
|
@@ -540,8 +541,8 @@ function ye({
|
|
|
540
541
|
]
|
|
541
542
|
}
|
|
542
543
|
) }),
|
|
543
|
-
/* @__PURE__ */ t(
|
|
544
|
-
|
|
544
|
+
/* @__PURE__ */ t(Be, { align: "end", className: "min-w-[140px]", children: f.map((L, O) => /* @__PURE__ */ x(
|
|
545
|
+
He,
|
|
545
546
|
{
|
|
546
547
|
className: "cursor-pointer text-[12px]",
|
|
547
548
|
onSelect: () => z(L, O + 1),
|
|
@@ -555,9 +556,9 @@ function ye({
|
|
|
555
556
|
},
|
|
556
557
|
L.id ?? O
|
|
557
558
|
)) })
|
|
558
|
-
] }) }) : /* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
|
|
559
|
+
] }) }) : /* @__PURE__ */ x("div", { className: "flex items-center", children: [
|
|
560
|
+
/* @__PURE__ */ x(
|
|
561
|
+
le,
|
|
561
562
|
{
|
|
562
563
|
type: "button",
|
|
563
564
|
variant: g,
|
|
@@ -568,13 +569,13 @@ function ye({
|
|
|
568
569
|
onClick: () => z(e, 0),
|
|
569
570
|
children: [
|
|
570
571
|
D && /* @__PURE__ */ t(D, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
571
|
-
|
|
572
|
+
p ? "…" : v === u ? "✓ Copied" : A
|
|
572
573
|
]
|
|
573
574
|
}
|
|
574
575
|
),
|
|
575
|
-
/* @__PURE__ */
|
|
576
|
-
/* @__PURE__ */ t(
|
|
577
|
-
|
|
576
|
+
/* @__PURE__ */ x(We, { children: [
|
|
577
|
+
/* @__PURE__ */ t(Me, { asChild: !0, children: /* @__PURE__ */ t(
|
|
578
|
+
le,
|
|
578
579
|
{
|
|
579
580
|
type: "button",
|
|
580
581
|
variant: g,
|
|
@@ -595,8 +596,8 @@ function ye({
|
|
|
595
596
|
) })
|
|
596
597
|
}
|
|
597
598
|
) }),
|
|
598
|
-
/* @__PURE__ */ t(
|
|
599
|
-
|
|
599
|
+
/* @__PURE__ */ t(Be, { align: "end", className: "min-w-[140px]", children: f.map((L, O) => /* @__PURE__ */ x(
|
|
600
|
+
He,
|
|
600
601
|
{
|
|
601
602
|
className: "text-[12px]",
|
|
602
603
|
onSelect: () => z(L, O + 1),
|
|
@@ -613,17 +614,17 @@ function ye({
|
|
|
613
614
|
] })
|
|
614
615
|
] });
|
|
615
616
|
}
|
|
616
|
-
return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: l.map((e,
|
|
617
|
+
return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: l.map((e, f) => Z(e, f)) });
|
|
617
618
|
}
|
|
618
|
-
function
|
|
619
|
+
function Zr({
|
|
619
620
|
widgetId: l,
|
|
620
621
|
inputBindings: s = [],
|
|
621
622
|
itemDraft: o = {},
|
|
622
|
-
itemCollection:
|
|
623
|
+
itemCollection: i,
|
|
623
624
|
ready: c = !0,
|
|
624
625
|
label: m,
|
|
625
626
|
defaultExpanded: v = !0,
|
|
626
|
-
frameless:
|
|
627
|
+
frameless: b = !1,
|
|
627
628
|
apiBase: _,
|
|
628
629
|
compact: R = !1,
|
|
629
630
|
strip: $ = !1,
|
|
@@ -631,29 +632,29 @@ function Gr({
|
|
|
631
632
|
onWidgetType: U,
|
|
632
633
|
onContentChange: q
|
|
633
634
|
}) {
|
|
634
|
-
var
|
|
635
|
-
const C =
|
|
635
|
+
var Oe, Ie;
|
|
636
|
+
const C = ve(), E = _ ?? C.apiBase, [G, oe] = P(v), [r, z] = P(null), [a, Z] = P(null), [e, f] = P(!0), [u, p] = P(!0), [T, A] = P(!0), [g, N] = P(null), [W, D] = P(0), [H, L] = P(null), O = ie(!1), V = De(() => {
|
|
636
637
|
O.current = !0, D((n) => n + 1);
|
|
637
|
-
}, []),
|
|
638
|
+
}, []), ce = ie(null), de = ie(!1), Ne = Xe();
|
|
638
639
|
Y(() => {
|
|
639
640
|
const n = r == null ? void 0 : r.widget_type;
|
|
640
641
|
if (n !== "rollup" && n !== "review_list" && n !== "custom-query") return;
|
|
641
642
|
let d = null;
|
|
642
|
-
const y =
|
|
643
|
+
const y = Ne.getQueryCache().subscribe((S) => {
|
|
643
644
|
var K;
|
|
644
645
|
if (S.type !== "updated" || ((K = S.action) == null ? void 0 : K.type) !== "success") return;
|
|
645
|
-
const
|
|
646
|
-
typeof
|
|
646
|
+
const w = S.query.queryKey, j = w == null ? void 0 : w[0];
|
|
647
|
+
typeof j == "string" && (!j.startsWith("o2m-rows") && !j.startsWith("nested") && j !== "match-agg" && j !== "m2m-items" || S.query.state.dataUpdateCount <= 1 || j.startsWith("o2m-rows") && ce.current != null && String(w[3]) !== String(ce.current) || (d && clearTimeout(d), d = setTimeout(() => D((ne) => ne + 1), 400)));
|
|
647
648
|
});
|
|
648
649
|
return () => {
|
|
649
650
|
d && clearTimeout(d), y();
|
|
650
651
|
};
|
|
651
|
-
}, [
|
|
652
|
-
const
|
|
652
|
+
}, [Ne, r == null ? void 0 : r.widget_type]);
|
|
653
|
+
const ke = {};
|
|
653
654
|
for (const [n, d] of Object.entries(o))
|
|
654
|
-
n.includes(".") || (d == null || typeof d != "object") && (
|
|
655
|
-
const I = { ...
|
|
656
|
-
if ((r == null ? void 0 : r.widget_type) !== "rollup" || !
|
|
655
|
+
n.includes(".") || (d == null || typeof d != "object") && (ke[n] = d);
|
|
656
|
+
const I = { ...ke, ...Lr(s, o) }, ue = br(), F = qe(() => {
|
|
657
|
+
if ((r == null ? void 0 : r.widget_type) !== "rollup" || !ue) return null;
|
|
657
658
|
const n = r.config, d = n == null ? void 0 : n.collection;
|
|
658
659
|
if (!d) return null;
|
|
659
660
|
const y = {
|
|
@@ -661,33 +662,33 @@ function Gr({
|
|
|
661
662
|
updated: [],
|
|
662
663
|
deleted: []
|
|
663
664
|
};
|
|
664
|
-
for (const S of
|
|
665
|
-
const
|
|
666
|
-
|
|
665
|
+
for (const S of ue.byGrid.values()) {
|
|
666
|
+
const w = S[d];
|
|
667
|
+
w && (y.created.push(...w.created), y.updated.push(...w.updated), y.deleted.push(...w.deleted));
|
|
667
668
|
}
|
|
668
669
|
return !y.created.length && !y.updated.length && !y.deleted.length ? null : y;
|
|
669
|
-
}, [r,
|
|
670
|
+
}, [r, ue]), Ke = qe(
|
|
670
671
|
() => F ? JSON.stringify(F) : "",
|
|
671
672
|
[F]
|
|
672
|
-
), h = (
|
|
673
|
-
var S,
|
|
673
|
+
), h = (Oe = r == null ? void 0 : r.config) == null ? void 0 : Oe.drilldown, ee = ir(), fe = h != null && h.id_input ? I[h.id_input] : null, pe = !!ee && !!(h != null && h.collection) && fe != null && fe !== "", Se = async () => {
|
|
674
|
+
var S, w;
|
|
674
675
|
if (!pe || !(h != null && h.collection)) return;
|
|
675
|
-
const n = String(
|
|
676
|
+
const n = String(fe);
|
|
676
677
|
let d = null;
|
|
677
|
-
const y = (
|
|
678
|
+
const y = (j) => fetch(`${E}${j}`, {
|
|
678
679
|
credentials: C.credentials,
|
|
679
680
|
headers: C.authHeaders
|
|
680
681
|
});
|
|
681
682
|
try {
|
|
682
683
|
if (h.match_field) {
|
|
683
|
-
const
|
|
684
|
+
const j = await y(
|
|
684
685
|
`/items/${h.collection}?filter=${encodeURIComponent(
|
|
685
686
|
JSON.stringify({ [h.match_field]: { _eq: n } })
|
|
686
687
|
)}&fields=id&limit=1`
|
|
687
688
|
);
|
|
688
|
-
if (
|
|
689
|
-
const K = await
|
|
690
|
-
|
|
689
|
+
if (j.ok) {
|
|
690
|
+
const K = await j.json(), ne = (w = (S = K == null ? void 0 : K.data) == null ? void 0 : S[0]) == null ? void 0 : w.id;
|
|
691
|
+
ne != null && (d = String(ne));
|
|
691
692
|
}
|
|
692
693
|
}
|
|
693
694
|
d == null && (await y(`/items/${h.collection}/${encodeURIComponent(n)}?fields=id`)).ok && (d = n);
|
|
@@ -706,9 +707,9 @@ function Gr({
|
|
|
706
707
|
const n = o.id;
|
|
707
708
|
n != null && n !== "" && (I.record_id = n);
|
|
708
709
|
}
|
|
709
|
-
|
|
710
|
-
const
|
|
711
|
-
function
|
|
710
|
+
ce.current = o.id ?? null;
|
|
711
|
+
const Qe = JSON.stringify(I) + (i ?? "") + Ke, Ge = sr(Qe, 400);
|
|
712
|
+
function Re() {
|
|
712
713
|
const n = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "";
|
|
713
714
|
return {
|
|
714
715
|
"Content-Type": "application/json",
|
|
@@ -716,127 +717,127 @@ function Gr({
|
|
|
716
717
|
...n ? { "x-workspace": n } : {}
|
|
717
718
|
};
|
|
718
719
|
}
|
|
719
|
-
const X =
|
|
720
|
+
const X = ar(), B = Ye({
|
|
720
721
|
queryKey: ["nvr-widget-def", l],
|
|
721
722
|
enabled: c,
|
|
722
723
|
staleTime: 6e4,
|
|
723
724
|
retry: !1,
|
|
724
725
|
queryFn: async () => {
|
|
725
726
|
if (X)
|
|
726
|
-
return (await X.request(
|
|
727
|
+
return (await X.request(or(`/widgets-internal/${l}`))).data;
|
|
727
728
|
const n = await fetch(`${E}/widgets-internal/${l}`, {
|
|
728
729
|
credentials: C.credentials,
|
|
729
|
-
headers:
|
|
730
|
+
headers: Re()
|
|
730
731
|
});
|
|
731
732
|
if (!n.ok) throw Object.assign(new Error("Widget not found"), { status: n.status });
|
|
732
733
|
return (await n.json()).data;
|
|
733
734
|
}
|
|
734
|
-
}),
|
|
735
|
-
N(null), B.error ?
|
|
736
|
-
}, [B.error,
|
|
735
|
+
}), Le = B.refetch, me = De(() => {
|
|
736
|
+
N(null), B.error ? Le() : D((n) => n + 1);
|
|
737
|
+
}, [B.error, Le]);
|
|
737
738
|
Y(() => {
|
|
738
739
|
const n = () => D((d) => d + 1);
|
|
739
|
-
return window.addEventListener(
|
|
740
|
+
return window.addEventListener(Ue, n), () => window.removeEventListener(Ue, n);
|
|
740
741
|
}, []), Y(() => {
|
|
741
|
-
c && (B.data ? (z(B.data),
|
|
742
|
+
c && (B.data ? (z(B.data), f(!1), N(null), U == null || U(B.data.widget_type)) : B.error && N(Ae(B.error, "this widget")));
|
|
742
743
|
}, [c, B.data, B.error]), Y(() => {
|
|
743
744
|
if (!c || !r) return;
|
|
744
745
|
const n = I.record_id == null || I.record_id === "";
|
|
745
746
|
if (r.widget_type === "review_list" && n || r.widget_type === "rollup" && n && !F) return;
|
|
746
747
|
let d = !1;
|
|
747
|
-
return
|
|
748
|
+
return de.current || (p(!0), A(!0)), (async () => {
|
|
748
749
|
try {
|
|
749
750
|
const y = {
|
|
750
751
|
inputs: F ? { ...I, staged: F } : I,
|
|
751
752
|
draft: o,
|
|
752
753
|
bindings: s,
|
|
753
|
-
item_collection:
|
|
754
|
+
item_collection: i
|
|
754
755
|
};
|
|
755
756
|
O.current && (y.refresh = !0, O.current = !1), L(y);
|
|
756
757
|
let S;
|
|
757
758
|
if (X)
|
|
758
759
|
S = await X.request(
|
|
759
|
-
|
|
760
|
+
cr(`/widgets-internal/${l}/render`, y)
|
|
760
761
|
);
|
|
761
762
|
else {
|
|
762
|
-
const
|
|
763
|
+
const w = await fetch(`${E}/widgets-internal/${l}/render`, {
|
|
763
764
|
method: "POST",
|
|
764
765
|
credentials: C.credentials,
|
|
765
|
-
headers:
|
|
766
|
+
headers: Re(),
|
|
766
767
|
body: JSON.stringify(y)
|
|
767
768
|
});
|
|
768
|
-
if (!
|
|
769
|
-
throw Object.assign(new Error("Render failed"), { status:
|
|
770
|
-
S = await
|
|
769
|
+
if (!w.ok)
|
|
770
|
+
throw Object.assign(new Error("Render failed"), { status: w.status });
|
|
771
|
+
S = await w.json();
|
|
771
772
|
}
|
|
772
773
|
if (d) return;
|
|
773
|
-
d || (
|
|
774
|
+
d || (de.current = !0, Z(S.data), p(!1), N(null));
|
|
774
775
|
} catch (y) {
|
|
775
|
-
d || N(
|
|
776
|
+
d || N(Ae(y, "this widget"));
|
|
776
777
|
} finally {
|
|
777
778
|
d || A(!1);
|
|
778
779
|
}
|
|
779
780
|
})(), () => {
|
|
780
781
|
d = !0;
|
|
781
782
|
};
|
|
782
|
-
}, [l, E,
|
|
783
|
+
}, [l, E, Ge, c, W, r == null ? void 0 : r.widget_type]), Y(() => {
|
|
783
784
|
if (q) {
|
|
784
785
|
if (g) {
|
|
785
786
|
q(!0);
|
|
786
787
|
return;
|
|
787
788
|
}
|
|
788
|
-
if (
|
|
789
|
+
if (a) {
|
|
789
790
|
if ((r == null ? void 0 : r.widget_type) === "review_list" || (r == null ? void 0 : r.widget_type) === "rollup") {
|
|
790
|
-
const n =
|
|
791
|
+
const n = a.rows;
|
|
791
792
|
q(Array.isArray(n) && n.length > 0);
|
|
792
793
|
return;
|
|
793
794
|
}
|
|
794
|
-
if ((r == null ? void 0 : r.widget_type) === "custom-query" && "rows" in
|
|
795
|
-
const n =
|
|
795
|
+
if ((r == null ? void 0 : r.widget_type) === "custom-query" && "rows" in a) {
|
|
796
|
+
const n = a.rows;
|
|
796
797
|
q(Array.isArray(n) && n.length > 0);
|
|
797
798
|
return;
|
|
798
799
|
}
|
|
799
800
|
q(!0);
|
|
800
801
|
}
|
|
801
802
|
}
|
|
802
|
-
}, [
|
|
803
|
-
const J = m || (r == null ? void 0 : r.name) || "", te = (r == null ? void 0 : r.widget_type) === "report_widget" &&
|
|
804
|
-
const n =
|
|
803
|
+
}, [a, g, r == null ? void 0 : r.widget_type, q]);
|
|
804
|
+
const J = m || (r == null ? void 0 : r.name) || "", te = (r == null ? void 0 : r.widget_type) === "report_widget" && a ? vr(a) : a, M = (() => {
|
|
805
|
+
const n = a == null ? void 0 : a.awaiting;
|
|
805
806
|
if (!Array.isArray(n) || n.length === 0) return null;
|
|
806
807
|
const d = n.map((y) => {
|
|
807
|
-
const S = s.find((
|
|
808
|
-
return String((S == null ? void 0 : S.binding_value) ?? y).split(".")[0].replace(/_id$/, "").replace(/_/g, " ").replace(/^\w/, (
|
|
808
|
+
const S = s.find((j) => j.key === y && j.binding_type === "item_field");
|
|
809
|
+
return String((S == null ? void 0 : S.binding_value) ?? y).split(".")[0].replace(/_id$/, "").replace(/_/g, " ").replace(/^\w/, (j) => j.toUpperCase());
|
|
809
810
|
});
|
|
810
811
|
return [...new Set(d)].join(", ");
|
|
811
|
-
})(),
|
|
812
|
-
if ((r == null ? void 0 : r.widget_type) === "review_list" &&
|
|
812
|
+
})(), $e = I.record_id, Ce = $e == null || $e === "";
|
|
813
|
+
if ((r == null ? void 0 : r.widget_type) === "review_list" && Ce || (r == null ? void 0 : r.widget_type) === "rollup" && Ce && !F) return null;
|
|
813
814
|
if (R) {
|
|
814
|
-
const n = ((
|
|
815
|
+
const n = ((Ie = r == null ? void 0 : r.config) == null ? void 0 : Ie.compact_style) ?? "default", d = n === "pill-dark" || n === "pill-light";
|
|
815
816
|
if (g)
|
|
816
817
|
return /* @__PURE__ */ t(
|
|
817
818
|
"button",
|
|
818
819
|
{
|
|
819
820
|
type: "button",
|
|
820
|
-
onClick:
|
|
821
|
+
onClick: me,
|
|
821
822
|
"data-load-error": "",
|
|
822
823
|
"data-tip": `${g} Click to try again.`,
|
|
823
824
|
"aria-label": `${g} Try again`,
|
|
824
825
|
className: "inline-flex h-5 w-5 items-center justify-center rounded text-amber-500 hover:bg-amber-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-amber-400 dark:hover:bg-amber-400/10",
|
|
825
|
-
children: /* @__PURE__ */ t(
|
|
826
|
+
children: /* @__PURE__ */ t(Je, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
826
827
|
}
|
|
827
828
|
);
|
|
828
829
|
if ($) {
|
|
829
830
|
if (e)
|
|
830
|
-
return /* @__PURE__ */
|
|
831
|
+
return /* @__PURE__ */ x("div", { className: "flex h-full w-36 flex-col justify-center px-4 py-2.5", children: [
|
|
831
832
|
/* @__PURE__ */ t("span", { className: "animate-pulse h-2 w-10 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] mb-1" }),
|
|
832
833
|
/* @__PURE__ */ t("span", { className: "animate-pulse h-3.5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
833
834
|
] });
|
|
834
835
|
if (r.widget_type === "button-group")
|
|
835
|
-
return /* @__PURE__ */ t("div", { className: "h-full flex items-center px-3", children: u ? /* @__PURE__ */ t("div", { className: "animate-pulse h-7 w-24 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) :
|
|
836
|
-
|
|
836
|
+
return /* @__PURE__ */ t("div", { className: "h-full flex items-center px-3", children: u ? /* @__PURE__ */ t("div", { className: "animate-pulse h-7 w-24 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : a && /* @__PURE__ */ t(
|
|
837
|
+
be,
|
|
837
838
|
{
|
|
838
|
-
buttons:
|
|
839
|
-
layout:
|
|
839
|
+
buttons: a.buttons ?? [],
|
|
840
|
+
layout: a.layout ?? "flat",
|
|
840
841
|
widgetId: l,
|
|
841
842
|
inputs: I,
|
|
842
843
|
apiBase: E,
|
|
@@ -845,7 +846,7 @@ function Gr({
|
|
|
845
846
|
) });
|
|
846
847
|
{
|
|
847
848
|
const y = /* @__PURE__ */ t(
|
|
848
|
-
|
|
849
|
+
Sr,
|
|
849
850
|
{
|
|
850
851
|
data: u ? null : te ?? null,
|
|
851
852
|
label: m || r.name,
|
|
@@ -857,18 +858,18 @@ function Gr({
|
|
|
857
858
|
"button",
|
|
858
859
|
{
|
|
859
860
|
type: "button",
|
|
860
|
-
onClick: () => void
|
|
861
|
+
onClick: () => void Se(),
|
|
861
862
|
title: (h == null ? void 0 : h.title) ?? "Open details",
|
|
862
863
|
className: "h-full w-full cursor-pointer text-left transition-colors hover:bg-nvr-cyan/5",
|
|
863
864
|
"data-nvr-widget-drill": h == null ? void 0 : h.collection,
|
|
864
865
|
children: y
|
|
865
866
|
}
|
|
866
|
-
) : y,
|
|
867
|
-
return
|
|
867
|
+
) : y, w = a == null ? void 0 : a.cache;
|
|
868
|
+
return w != null && w.cache_ttl ? /* @__PURE__ */ x(
|
|
868
869
|
"div",
|
|
869
870
|
{
|
|
870
871
|
className: "group/cache relative h-full w-full",
|
|
871
|
-
"data-cache-stamp":
|
|
872
|
+
"data-cache-stamp": w.cached ? "cached" : "fresh",
|
|
872
873
|
children: [
|
|
873
874
|
S,
|
|
874
875
|
/* @__PURE__ */ t(
|
|
@@ -879,9 +880,9 @@ function Gr({
|
|
|
879
880
|
disabled: u,
|
|
880
881
|
"data-cache-refresh": !0,
|
|
881
882
|
"aria-label": "Refresh this figure",
|
|
882
|
-
"data-tip":
|
|
883
|
+
"data-tip": yr(w),
|
|
883
884
|
className: "absolute bottom-1 right-1 rounded p-0.5 text-muted-foreground opacity-0 transition-opacity hover:bg-muted group-hover/cache:opacity-100 focus-visible:opacity-100 disabled:opacity-50",
|
|
884
|
-
children: /* @__PURE__ */ t(
|
|
885
|
+
children: /* @__PURE__ */ t(ze, { className: `h-3 w-3 ${u ? "animate-spin" : ""}` })
|
|
885
886
|
}
|
|
886
887
|
)
|
|
887
888
|
]
|
|
@@ -899,7 +900,7 @@ function Gr({
|
|
|
899
900
|
);
|
|
900
901
|
{
|
|
901
902
|
const y = /* @__PURE__ */ t(
|
|
902
|
-
|
|
903
|
+
$r,
|
|
903
904
|
{
|
|
904
905
|
data: u ? null : te ?? null,
|
|
905
906
|
label: m || r.name,
|
|
@@ -913,7 +914,7 @@ function Gr({
|
|
|
913
914
|
"button",
|
|
914
915
|
{
|
|
915
916
|
type: "button",
|
|
916
|
-
onClick: () => void
|
|
917
|
+
onClick: () => void Se(),
|
|
917
918
|
title: (h == null ? void 0 : h.title) ?? "Open details",
|
|
918
919
|
className: "cursor-pointer text-left",
|
|
919
920
|
"data-nvr-widget-drill": h == null ? void 0 : h.collection,
|
|
@@ -922,24 +923,24 @@ function Gr({
|
|
|
922
923
|
) : y;
|
|
923
924
|
}
|
|
924
925
|
}
|
|
925
|
-
return e ? /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: u ? /* @__PURE__ */ t("div", { className: "flex items-baseline gap-1", children: /* @__PURE__ */ t("div", { className: "animate-pulse h-5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) }) :
|
|
926
|
-
(r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in
|
|
927
|
-
r.widget_type === "report_widget" && te && /* @__PURE__ */ t(
|
|
928
|
-
r.widget_type === "custom-query" && "values" in
|
|
926
|
+
return e ? /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: u ? /* @__PURE__ */ t("div", { className: "flex items-baseline gap-1", children: /* @__PURE__ */ t("div", { className: "animate-pulse h-5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) }) : a && r && /* @__PURE__ */ x(we, { children: [
|
|
927
|
+
(r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in a) && /* @__PURE__ */ t(ye, { data: a, awaiting: M }),
|
|
928
|
+
r.widget_type === "report_widget" && te && /* @__PURE__ */ t(ye, { data: te, awaiting: M }),
|
|
929
|
+
r.widget_type === "custom-query" && "values" in a && /* @__PURE__ */ t(Ve, { data: a }),
|
|
929
930
|
r.widget_type === "action-buttons" && /* @__PURE__ */ t(
|
|
930
|
-
|
|
931
|
+
Fe,
|
|
931
932
|
{
|
|
932
|
-
data:
|
|
933
|
+
data: a,
|
|
933
934
|
widgetId: l,
|
|
934
935
|
inputs: I,
|
|
935
936
|
apiBase: E
|
|
936
937
|
}
|
|
937
938
|
),
|
|
938
939
|
r.widget_type === "button-group" && /* @__PURE__ */ t(
|
|
939
|
-
|
|
940
|
+
be,
|
|
940
941
|
{
|
|
941
|
-
buttons:
|
|
942
|
-
layout:
|
|
942
|
+
buttons: a.buttons ?? [],
|
|
943
|
+
layout: a.layout ?? "flat",
|
|
943
944
|
widgetId: l,
|
|
944
945
|
inputs: I,
|
|
945
946
|
apiBase: E,
|
|
@@ -948,12 +949,8 @@ function Gr({
|
|
|
948
949
|
)
|
|
949
950
|
] }) });
|
|
950
951
|
}
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
/* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-full rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
954
|
-
/* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-5/6 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
955
|
-
] }), Ce = X ? /* @__PURE__ */ t(
|
|
956
|
-
mr,
|
|
952
|
+
const re = r == null ? void 0 : r.widget_type, Ee = re === "stat" ? /* @__PURE__ */ t(he, { framed: !1, title: !1, kpi: !0, className: "py-0.5" }) : re === "list" || re === "review_list" || re === "custom-query" ? /* @__PURE__ */ t(he, { framed: !1, title: !1, lines: 4, className: "py-0.5" }) : /* @__PURE__ */ t(he, { framed: !1, title: !1, lines: 3, className: "py-0.5" }), Te = X ? /* @__PURE__ */ t(
|
|
953
|
+
gr,
|
|
957
954
|
{
|
|
958
955
|
className: "mt-2",
|
|
959
956
|
pending: u && !!r,
|
|
@@ -961,43 +958,43 @@ function Gr({
|
|
|
961
958
|
label: J || "Widget",
|
|
962
959
|
onResult: (n) => {
|
|
963
960
|
const d = n == null ? void 0 : n.data;
|
|
964
|
-
d && (
|
|
961
|
+
d && (de.current = !0, Z(d), p(!1), A(!1), N(null));
|
|
965
962
|
},
|
|
966
963
|
onGone: () => D((n) => n + 1)
|
|
967
964
|
}
|
|
968
965
|
) : null;
|
|
969
|
-
if (
|
|
970
|
-
return /* @__PURE__ */
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
g && /* @__PURE__ */ t(
|
|
974
|
-
!
|
|
966
|
+
if (b)
|
|
967
|
+
return /* @__PURE__ */ x("div", { children: [
|
|
968
|
+
T && Ee,
|
|
969
|
+
T && Te,
|
|
970
|
+
g && /* @__PURE__ */ t(Pe, { message: g, onRetry: me }),
|
|
971
|
+
!T && !g && a && r && je()
|
|
975
972
|
] });
|
|
976
|
-
return /* @__PURE__ */
|
|
977
|
-
/* @__PURE__ */
|
|
973
|
+
return /* @__PURE__ */ x("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
974
|
+
/* @__PURE__ */ x(
|
|
978
975
|
"button",
|
|
979
976
|
{
|
|
980
977
|
type: "button",
|
|
981
978
|
className: "flex w-full items-center justify-between px-4 py-3 text-left",
|
|
982
|
-
onClick: () =>
|
|
979
|
+
onClick: () => oe((n) => !n),
|
|
983
980
|
children: [
|
|
984
981
|
/* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: J || /* @__PURE__ */ t("span", { className: "inline-block h-3 w-28 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))] align-middle" }) }),
|
|
985
982
|
/* @__PURE__ */ t("span", { className: `text-slate-400 transition-transform ${G ? "rotate-90" : ""}`, children: "›" })
|
|
986
983
|
]
|
|
987
984
|
}
|
|
988
985
|
),
|
|
989
|
-
G && /* @__PURE__ */
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
g && /* @__PURE__ */ t(
|
|
993
|
-
!
|
|
986
|
+
G && /* @__PURE__ */ x("div", { className: "border-t border-slate-100 px-4 py-3 dark:border-border", children: [
|
|
987
|
+
T && Ee,
|
|
988
|
+
T && Te,
|
|
989
|
+
g && /* @__PURE__ */ t(Pe, { message: g, onRetry: me }),
|
|
990
|
+
!T && !g && a && r && je()
|
|
994
991
|
] })
|
|
995
992
|
] });
|
|
996
|
-
function
|
|
993
|
+
function je() {
|
|
997
994
|
var n;
|
|
998
|
-
return !
|
|
999
|
-
(r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in
|
|
1000
|
-
r.widget_type === "custom-query" && "values" in
|
|
995
|
+
return !a || !r ? null : /* @__PURE__ */ x(we, { children: [
|
|
996
|
+
(r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in a) && /* @__PURE__ */ t(ye, { data: a, awaiting: M }),
|
|
997
|
+
r.widget_type === "custom-query" && "values" in a && (M ? /* @__PURE__ */ x(
|
|
1001
998
|
"p",
|
|
1002
999
|
{
|
|
1003
1000
|
className: "text-[12px] text-slate-500 dark:text-slate-400",
|
|
@@ -1010,9 +1007,9 @@ function Gr({
|
|
|
1010
1007
|
"."
|
|
1011
1008
|
]
|
|
1012
1009
|
}
|
|
1013
|
-
) : /* @__PURE__ */ t(
|
|
1014
|
-
r.widget_type === "list" && /* @__PURE__ */ t(
|
|
1015
|
-
M && r.widget_type === "custom-query" && "rows" in
|
|
1010
|
+
) : /* @__PURE__ */ t(Ve, { data: a })),
|
|
1011
|
+
r.widget_type === "list" && /* @__PURE__ */ t(Cr, { data: a }),
|
|
1012
|
+
M && r.widget_type === "custom-query" && "rows" in a && /* @__PURE__ */ x(
|
|
1016
1013
|
"p",
|
|
1017
1014
|
{
|
|
1018
1015
|
className: "text-[12px] text-slate-500 dark:text-slate-400",
|
|
@@ -1026,18 +1023,18 @@ function Gr({
|
|
|
1026
1023
|
]
|
|
1027
1024
|
}
|
|
1028
1025
|
),
|
|
1029
|
-
!M && r.widget_type === "custom-query" && "rows" in
|
|
1030
|
-
|
|
1026
|
+
!M && r.widget_type === "custom-query" && "rows" in a && /* @__PURE__ */ t(
|
|
1027
|
+
wr,
|
|
1031
1028
|
{
|
|
1032
|
-
rows:
|
|
1029
|
+
rows: a.rows ?? [],
|
|
1033
1030
|
config: (n = r.config) == null ? void 0 : n.table,
|
|
1034
1031
|
emptyLabel: J
|
|
1035
1032
|
}
|
|
1036
1033
|
),
|
|
1037
1034
|
r.widget_type === "review_list" && /* @__PURE__ */ t(
|
|
1038
|
-
|
|
1035
|
+
Nr,
|
|
1039
1036
|
{
|
|
1040
|
-
data:
|
|
1037
|
+
data: a,
|
|
1041
1038
|
config: r.config ?? {},
|
|
1042
1039
|
onRefetch: () => D((d) => d + 1),
|
|
1043
1040
|
hostRecordId: I.record_id,
|
|
@@ -1045,28 +1042,28 @@ function Gr({
|
|
|
1045
1042
|
}
|
|
1046
1043
|
),
|
|
1047
1044
|
r.widget_type === "rollup" && /* @__PURE__ */ t(
|
|
1048
|
-
|
|
1045
|
+
kr,
|
|
1049
1046
|
{
|
|
1050
|
-
data:
|
|
1047
|
+
data: a,
|
|
1051
1048
|
config: r.config ?? {},
|
|
1052
1049
|
emptyLabel: J
|
|
1053
1050
|
}
|
|
1054
1051
|
),
|
|
1055
|
-
r.widget_type === "report_widget" && /* @__PURE__ */ t(
|
|
1052
|
+
r.widget_type === "report_widget" && /* @__PURE__ */ t(_r, { payload: a }),
|
|
1056
1053
|
r.widget_type === "action-buttons" && /* @__PURE__ */ t(
|
|
1057
|
-
|
|
1054
|
+
Fe,
|
|
1058
1055
|
{
|
|
1059
|
-
data:
|
|
1056
|
+
data: a,
|
|
1060
1057
|
widgetId: l,
|
|
1061
1058
|
inputs: I,
|
|
1062
1059
|
apiBase: E
|
|
1063
1060
|
}
|
|
1064
1061
|
),
|
|
1065
1062
|
r.widget_type === "button-group" && /* @__PURE__ */ t(
|
|
1066
|
-
|
|
1063
|
+
be,
|
|
1067
1064
|
{
|
|
1068
|
-
buttons:
|
|
1069
|
-
layout:
|
|
1065
|
+
buttons: a.buttons ?? [],
|
|
1066
|
+
layout: a.layout ?? "flat",
|
|
1070
1067
|
widgetId: l,
|
|
1071
1068
|
inputs: I,
|
|
1072
1069
|
apiBase: E,
|
|
@@ -1082,11 +1079,11 @@ function Gr({
|
|
|
1082
1079
|
"review_list",
|
|
1083
1080
|
"rollup",
|
|
1084
1081
|
"report_widget"
|
|
1085
|
-
].includes(r.widget_type) && /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap text-[11px] text-slate-500", children: JSON.stringify(
|
|
1086
|
-
|
|
1087
|
-
|
|
1082
|
+
].includes(r.widget_type) && /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap text-[11px] text-slate-500", children: JSON.stringify(a, null, 2) }),
|
|
1083
|
+
a.cache ? /* @__PURE__ */ t(
|
|
1084
|
+
xr,
|
|
1088
1085
|
{
|
|
1089
|
-
envelope:
|
|
1086
|
+
envelope: a.cache,
|
|
1090
1087
|
onRefresh: V,
|
|
1091
1088
|
refreshing: u,
|
|
1092
1089
|
className: "mt-2 justify-end"
|
|
@@ -1096,5 +1093,5 @@ function Gr({
|
|
|
1096
1093
|
}
|
|
1097
1094
|
}
|
|
1098
1095
|
export {
|
|
1099
|
-
|
|
1096
|
+
Zr as WidgetSlot
|
|
1100
1097
|
};
|