@nivaro/react 0.3.113 → 0.3.115
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/ScreenShareHost.js +24 -0
- package/dist/full.css +50 -2
- package/dist/hooks/useSessionRecorder.js +61 -60
- package/dist/index.d.ts +1727 -19
- package/dist/index.js +1091 -950
- package/dist/shared/components/ActivityEntry.js +209 -97
- package/dist/shared/components/AgentPresenceChip.js +51 -0
- package/dist/shared/components/AnnouncementBanner.js +56 -41
- package/dist/shared/components/AutolinkedText.js +98 -85
- package/dist/shared/components/BroadcastView.js +149 -141
- package/dist/shared/components/CacheStamp.js +78 -30
- package/dist/shared/components/CollectionBrowserView.js +4088 -3592
- package/dist/shared/components/ConfigChangeStrip.js +63 -0
- package/dist/shared/components/ConfigReachNote.js +107 -0
- package/dist/shared/components/ConformanceView.js +389 -319
- package/dist/shared/components/DataTable.js +544 -504
- package/dist/shared/components/DelegateCoverLine.js +164 -0
- package/dist/shared/components/EnvironmentNotice.js +56 -65
- package/dist/shared/components/FilePreviewLightbox.js +89 -43
- package/dist/shared/components/FindingFixedMark.js +23 -0
- package/dist/shared/components/GridPresenceLine.js +100 -0
- package/dist/shared/components/IdleReloadWatcher.js +82 -43
- package/dist/shared/components/InStep.js +46 -0
- package/dist/shared/components/ItemEditForm.js +5504 -4889
- package/dist/shared/components/LiveAnnouncer.js +62 -0
- package/dist/shared/components/LiveCount.js +54 -0
- package/dist/shared/components/LiveFigure.js +28 -0
- package/dist/shared/components/LiveListControls.js +114 -0
- package/dist/shared/components/LiveNewMatchesPill.js +25 -0
- package/dist/shared/components/LiveOffNote.js +44 -0
- package/dist/shared/components/LivePreferenceHost.js +42 -0
- package/dist/shared/components/LiveRowMark.js +25 -20
- package/dist/shared/components/LiveTraceView.js +257 -0
- package/dist/shared/components/MapView.js +30 -29
- package/dist/shared/components/MatrixEditor.js +497 -462
- package/dist/shared/components/MyWorkView.js +346 -272
- package/dist/shared/components/NotificationBell.js +215 -201
- package/dist/shared/components/PageRenderer.js +636 -599
- package/dist/shared/components/PresenceDot.js +21 -0
- package/dist/shared/components/ProfileView.js +656 -536
- package/dist/shared/components/RealtimeStatusBanner.js +25 -25
- package/dist/shared/components/RecentRecordsRail.js +51 -48
- package/dist/shared/components/RecordCompare.js +241 -150
- package/dist/shared/components/RecordDrilldownSheet.js +66 -64
- package/dist/shared/components/RecordGridEditor.js +350 -311
- package/dist/shared/components/RecordHoverCard.js +147 -0
- package/dist/shared/components/RecordPeekHost.js +111 -0
- package/dist/shared/components/RecordReadView.js +414 -412
- package/dist/shared/components/RelativeTime.js +16 -0
- package/dist/shared/components/ReportView.js +1396 -1304
- package/dist/shared/components/ScreenRefreshButton.js +77 -0
- package/dist/shared/components/TabCountHost.js +10 -0
- package/dist/shared/components/TickerNumber.js +19 -18
- package/dist/shared/components/TipLayer.js +70 -58
- package/dist/shared/components/WidgetImageMenu.js +59 -0
- package/dist/shared/components/WidgetSlot.js +571 -524
- package/dist/shared/components/activity/RecordActivityStream.js +317 -0
- package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
- package/dist/shared/components/cbv/approval-changed.js +20 -0
- package/dist/shared/components/cbv/changed-by-others.js +251 -0
- package/dist/shared/components/cbv/column-totals.js +75 -67
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
- package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
- package/dist/shared/components/change-proposals/types.js +4 -0
- package/dist/shared/components/chat/ChatPanel.js +1571 -1528
- package/dist/shared/components/chat/Composer.js +276 -298
- package/dist/shared/components/chat/room-due.js +13 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
- package/dist/shared/components/collections-directory/directory-data.js +75 -63
- package/dist/shared/components/imports/ImportConsole.js +159 -155
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
- package/dist/shared/components/integrations/SendStatus.js +202 -0
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
- package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
- package/dist/shared/components/integrations/console/api.js +161 -117
- package/dist/shared/components/integrations/console/tone.js +15 -12
- package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
- package/dist/shared/components/item-edit/CloneDialog.js +208 -206
- package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
- package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
- package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
- package/dist/shared/components/item-edit/FieldComments.js +159 -116
- package/dist/shared/components/item-edit/FieldPointer.js +132 -0
- package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
- package/dist/shared/components/item-edit/FieldRow.js +519 -439
- package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
- package/dist/shared/components/item-edit/FilePickerField.js +454 -369
- package/dist/shared/components/item-edit/GroupSection.js +618 -567
- package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
- package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
- package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
- package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
- package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
- package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
- package/dist/shared/components/item-edit/PickerBadges.js +52 -0
- package/dist/shared/components/item-edit/PlanGrid.js +434 -439
- package/dist/shared/components/item-edit/RecalcValue.js +55 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
- package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
- package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
- package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
- package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
- package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
- package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
- package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
- package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
- package/dist/shared/components/item-edit/SectionPresence.js +78 -0
- package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
- package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
- package/dist/shared/components/item-edit/coedit/collab.js +84 -0
- package/dist/shared/components/item-edit/coedit/context.js +24 -0
- package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
- package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
- package/dist/shared/components/item-edit/coedit/session.js +382 -0
- package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
- package/dist/shared/components/item-edit/file-live.js +77 -0
- package/dist/shared/components/item-edit/file-processing.js +87 -0
- package/dist/shared/components/item-edit/layout-switch.js +148 -0
- package/dist/shared/components/item-edit/live-related.js +23 -0
- package/dist/shared/components/item-edit/live-title.js +66 -0
- package/dist/shared/components/item-edit/partner-needs.js +142 -0
- package/dist/shared/components/item-edit/removed-line.js +58 -0
- package/dist/shared/components/item-edit/render-stability.js +70 -59
- package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
- package/dist/shared/components/layout-editor/CollabParts.js +72 -70
- package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
- package/dist/shared/components/list/InlineEdit.js +504 -208
- package/dist/shared/components/list/ListViewers.js +81 -0
- package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
- package/dist/shared/components/merge/MergeWithFlow.js +290 -0
- package/dist/shared/components/merge/merge-values.js +110 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
- package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
- package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
- package/dist/shared/components/notifications/bundles.js +21 -19
- package/dist/shared/components/notifications/resolved-line.js +25 -0
- package/dist/shared/components/ops/OpsTasksView.js +45 -44
- package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
- package/dist/shared/components/panels/AlertBanners.js +132 -0
- package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
- package/dist/shared/components/panels/BranchLanes.js +82 -54
- package/dist/shared/components/panels/CommentAwareness.js +332 -0
- package/dist/shared/components/panels/CommentImages.js +219 -0
- package/dist/shared/components/panels/CommentPanel.js +649 -530
- package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
- package/dist/shared/components/panels/NewSinceChip.js +16 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
- package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
- package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
- package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
- package/dist/shared/components/panels/SlaClock.js +130 -99
- package/dist/shared/components/panels/TaskPanel.js +308 -287
- package/dist/shared/components/panels/unseen-move-check.js +101 -0
- package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
- package/dist/shared/components/profile/AgentNameField.js +141 -0
- package/dist/shared/components/profile/AgentsPanel.js +55 -46
- package/dist/shared/components/profile/PersonAccess.js +398 -330
- package/dist/shared/components/profile/PersonAdminTools.js +127 -113
- package/dist/shared/components/profile/PersonProfile.js +81 -73
- package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
- package/dist/shared/components/queue/QueueBulkBar.js +101 -84
- package/dist/shared/components/queue/QueueItemSheet.js +66 -66
- package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
- package/dist/shared/components/queue/QueueWorklist.js +2076 -1686
- package/dist/shared/components/queue/queue-totals.js +92 -0
- package/dist/shared/components/queue/worklist-helpers.js +18 -14
- package/dist/shared/components/send-view/SendViewButton.js +136 -0
- package/dist/shared/components/send-view/SentViewCards.js +147 -0
- package/dist/shared/components/support/ReportProblem.js +1 -0
- package/dist/shared/components/support/ScreenShare.js +554 -0
- package/dist/shared/components/support/SupportView.js +160 -129
- package/dist/shared/components/support/TicketDetailSheet.js +101 -89
- package/dist/shared/components/watch-list/WatchDock.js +1044 -0
- package/dist/shared/components/watch-list/WatchExtras.js +723 -0
- package/dist/shared/components/watch-list/WatchListButton.js +46 -0
- package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
- package/dist/shared/components/watch-list/WatchRows.js +348 -0
- package/dist/shared/lib/activity-sentence.js +87 -75
- package/dist/shared/lib/agent-presence.js +46 -0
- package/dist/shared/lib/approval-progress.js +49 -0
- package/dist/shared/lib/attention-prefs.js +27 -0
- package/dist/shared/lib/cell-locks.js +56 -0
- package/dist/shared/lib/co-edit.js +166 -0
- package/dist/shared/lib/coedit-registry.js +44 -0
- package/dist/shared/lib/comment-awareness.js +124 -0
- package/dist/shared/lib/comment-images.js +45 -0
- package/dist/shared/lib/config-watch.js +94 -0
- package/dist/shared/lib/copy-rules.js +65 -0
- package/dist/shared/lib/count-step.js +30 -0
- package/dist/shared/lib/deadline-ticker.js +68 -0
- package/dist/shared/lib/derived-causes.js +115 -0
- package/dist/shared/lib/draft-store.js +114 -85
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/field-merge.js +126 -0
- package/dist/shared/lib/filter-sentence.js +10 -10
- package/dist/shared/lib/focus-mode.js +16 -12
- package/dist/shared/lib/grid-cursors.js +77 -0
- package/dist/shared/lib/grid-presence.js +182 -0
- package/dist/shared/lib/idle-reload.js +100 -73
- package/dist/shared/lib/in-step.js +45 -0
- package/dist/shared/lib/integration-chip.js +19 -18
- package/dist/shared/lib/line-locks.js +141 -0
- package/dist/shared/lib/line-split.js +41 -0
- package/dist/shared/lib/linked-changes.js +150 -0
- package/dist/shared/lib/list-link.js +56 -50
- package/dist/shared/lib/list-return.js +231 -0
- package/dist/shared/lib/list-viewers.js +52 -0
- package/dist/shared/lib/live-announcer.js +86 -0
- package/dist/shared/lib/live-counts.js +85 -0
- package/dist/shared/lib/live-data-changed.js +108 -0
- package/dist/shared/lib/live-deltas.js +81 -0
- package/dist/shared/lib/live-findings.js +113 -0
- package/dist/shared/lib/live-groups.js +122 -0
- package/dist/shared/lib/live-link-labels.js +162 -0
- package/dist/shared/lib/live-list-flow.js +334 -0
- package/dist/shared/lib/live-list.js +143 -129
- package/dist/shared/lib/live-moves.js +51 -0
- package/dist/shared/lib/live-ops.js +26 -26
- package/dist/shared/lib/live-pickers.js +7 -0
- package/dist/shared/lib/live-preference.js +184 -0
- package/dist/shared/lib/live-queries.js +226 -181
- package/dist/shared/lib/live-screen.js +333 -0
- package/dist/shared/lib/live-search.js +108 -0
- package/dist/shared/lib/live-seen.js +35 -0
- package/dist/shared/lib/live-views.js +100 -0
- package/dist/shared/lib/live.js +159 -133
- package/dist/shared/lib/missed-updates.js +198 -0
- package/dist/shared/lib/newer-file.js +56 -0
- package/dist/shared/lib/notification-sound.js +42 -20
- package/dist/shared/lib/own-writes.js +59 -41
- package/dist/shared/lib/picker-badges.js +94 -0
- package/dist/shared/lib/presence-signals.js +131 -84
- package/dist/shared/lib/realtime.js +49 -24
- package/dist/shared/lib/record-gaps.js +85 -0
- package/dist/shared/lib/record-outbox.js +369 -222
- package/dist/shared/lib/record-peek.js +75 -0
- package/dist/shared/lib/record-tabs.js +92 -72
- package/dist/shared/lib/relative-ticker.js +42 -0
- package/dist/shared/lib/request-gate.js +119 -119
- package/dist/shared/lib/rollup-recalc.js +107 -0
- package/dist/shared/lib/room-gaps.js +40 -36
- package/dist/shared/lib/rum.js +137 -87
- package/dist/shared/lib/save-progress.js +20 -0
- package/dist/shared/lib/scheduled-countdown.js +67 -0
- package/dist/shared/lib/screen-refresh.js +160 -0
- package/dist/shared/lib/screen-share.js +234 -0
- package/dist/shared/lib/seen-since.js +74 -0
- package/dist/shared/lib/selection-watch.js +205 -0
- package/dist/shared/lib/send-status.js +132 -0
- package/dist/shared/lib/send-view.js +23 -0
- package/dist/shared/lib/socket-liveness.js +155 -0
- package/dist/shared/lib/socket-realtime.js +168 -140
- package/dist/shared/lib/state-census.js +53 -0
- package/dist/shared/lib/summary-mode.js +61 -39
- package/dist/shared/lib/tab-attention.js +143 -32
- package/dist/shared/lib/table-density.js +64 -0
- package/dist/shared/lib/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +33 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-online-users.js +32 -11
- package/dist/shared/lib/user-sync.js +155 -39
- package/dist/shared/lib/waiting-count.js +44 -0
- package/dist/shared/lib/watch-desktop.js +83 -0
- package/dist/shared/lib/watch-list.js +447 -0
- package/dist/shared/lib/widget-image-render.js +64 -0
- package/dist/shared/lib/widget-image.js +111 -0
- package/dist/shared/lib/worker-socket.js +130 -104
- package/dist/shared/lib/write-to-screen.js +133 -0
- package/package.json +1 -1
- package/styles.css +49 -1
|
@@ -1,95 +1,96 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { AlertTriangle as
|
|
4
|
-
import { useState 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 {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
1
|
+
import { jsx as t, jsxs as x, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as dt, useQuery as ft } from "@tanstack/react-query";
|
|
3
|
+
import { AlertTriangle as lt, RefreshCw as it, MoreVertical as pt, MoreHorizontal as mt, Clipboard as ht, Copy as gt, Clock as yt, Calendar as wt, Paperclip as xt, Folder as bt, File as vt, FileText as _t, Bell as kt, Phone as Nt, MessageSquare as St, Mail as Rt, UserCheck as Lt, UserPlus as Ct, Users as $t, User as Et, Activity as Tt, Zap as qt, Power as jt, Search as Ot, Filter as It, Sliders as Dt, Settings as At, RotateCcw as Wt, Pause as Ut, Play as Pt, HelpCircle as Mt, Info as Ht, AlertCircle as Bt, Flag as Vt, Bookmark as Ft, Heart as Kt, Star as Gt, Unlock as Jt, Lock as Qt, EyeOff as zt, Eye as Xt, Send as Yt, Upload as Zt, Download as er, Save as tr, Trash2 as rr, Edit2 as nr, Edit as sr, Minus as lr, Plus as ir, XCircle as ar, X as or, CheckCircle as cr, Check as ur, Share2 as dr, Link as fr, ExternalLink as pr, ArrowUpRight as mr, ArrowDown as hr, ArrowUp as gr, ArrowLeft as yr, ArrowRight as wr } from "lucide-react";
|
|
4
|
+
import { useState as B, useRef as F, useCallback as Ne, useEffect as Y, useMemo as Je } from "react";
|
|
5
|
+
import { useApiFetchConfig as Te, useDrilldown as xr, useOptionalNivaroClient as br } from "../context.js";
|
|
6
|
+
import { useDebounced as vr } from "../hooks/useDebounced.js";
|
|
7
|
+
import { PRETEND_DOWN_EVENT as Qe } from "../lib/client-chaos.js";
|
|
8
|
+
import { get as _r, post as kr } from "../lib/commands.js";
|
|
9
|
+
import { HEADER_CELL_DENSE as Nr, HEADER_CELL_LIST as Sr, HEADER_LABEL as Rr, HEADER_VALUE_LINE as Lr, HEADER_VALUE_HERO as Cr, HEADER_VALUE as $r } from "../lib/header-strip.js";
|
|
10
|
+
import { useLiveRecord as Er, LIVE_ASPECTS as se } from "../lib/live.js";
|
|
11
|
+
import { loadErrorText as ze } from "../lib/load-error.js";
|
|
12
|
+
import { useStartsOpen as Tr } from "../lib/use-starts-open.js";
|
|
13
|
+
import { affixesFor as fe, formatWidgetValue as pe } from "../lib/widget-value-format.js";
|
|
14
|
+
import { BackgroundRunOffer as qr } from "./BackgroundRunOffer.js";
|
|
15
|
+
import { cacheStampTip as jr, LiveCacheStamp as Or } from "./CacheStamp.js";
|
|
16
|
+
import { useStagedRelations as Ir } from "./item-edit/O2MStagingContext.js";
|
|
17
|
+
import { LoadErrorNote as Xe } from "./LoadErrorNote.js";
|
|
18
|
+
import { QueryTable as Dr } from "./QueryTable.js";
|
|
19
|
+
import { CardSkeleton as Se } from "./Skeletons.js";
|
|
20
|
+
import { Button as de } from "./ui/button.js";
|
|
21
|
+
import { DropdownMenu as Ye, DropdownMenuTrigger as Ze, DropdownMenuContent as et, DropdownMenuItem as tt } from "./ui/dropdown-menu.js";
|
|
22
|
+
import { reportSlotScalar as Ar, ReportSlotWidget as Wr } from "./widgets/ReportSlotWidget.js";
|
|
23
|
+
import { ReviewListWidget as Ur } from "./widgets/ReviewListWidget.js";
|
|
24
|
+
import { RollupWidget as Pr } from "./widgets/RollupWidget.js";
|
|
25
|
+
const te = {
|
|
26
|
+
ArrowRight: wr,
|
|
27
|
+
ArrowLeft: yr,
|
|
28
|
+
ArrowUp: gr,
|
|
29
|
+
ArrowDown: hr,
|
|
30
|
+
ArrowUpRight: mr,
|
|
31
|
+
ExternalLink: pr,
|
|
32
|
+
Link: fr,
|
|
33
|
+
Share2: dr,
|
|
34
|
+
Check: ur,
|
|
35
|
+
CheckCircle: cr,
|
|
36
|
+
X: or,
|
|
37
|
+
XCircle: ar,
|
|
38
|
+
Plus: ir,
|
|
39
|
+
Minus: lr,
|
|
40
|
+
Edit: sr,
|
|
41
|
+
Edit2: nr,
|
|
42
|
+
Trash2: rr,
|
|
43
|
+
Save: tr,
|
|
44
|
+
Download: er,
|
|
45
|
+
Upload: Zt,
|
|
46
|
+
Send: Yt,
|
|
47
|
+
Eye: Xt,
|
|
48
|
+
EyeOff: zt,
|
|
49
|
+
Lock: Qt,
|
|
50
|
+
Unlock: Jt,
|
|
51
|
+
Star: Gt,
|
|
52
|
+
Heart: Kt,
|
|
53
|
+
Bookmark: Ft,
|
|
54
|
+
Flag: Vt,
|
|
55
|
+
AlertCircle: Bt,
|
|
56
|
+
AlertTriangle: lt,
|
|
57
|
+
Info: Ht,
|
|
58
|
+
HelpCircle: Mt,
|
|
59
|
+
Play: Pt,
|
|
60
|
+
Pause: Ut,
|
|
61
|
+
RefreshCw: it,
|
|
62
|
+
RotateCcw: Wt,
|
|
63
|
+
Settings: At,
|
|
64
|
+
Sliders: Dt,
|
|
65
|
+
Filter: It,
|
|
66
|
+
Search: Ot,
|
|
67
|
+
Power: jt,
|
|
68
|
+
Zap: qt,
|
|
69
|
+
Activity: Tt,
|
|
70
|
+
User: Et,
|
|
71
|
+
Users: $t,
|
|
72
|
+
UserPlus: Ct,
|
|
73
|
+
UserCheck: Lt,
|
|
74
|
+
Mail: Rt,
|
|
75
|
+
MessageSquare: St,
|
|
76
|
+
Phone: Nt,
|
|
77
|
+
Bell: kt,
|
|
78
|
+
FileText: _t,
|
|
79
|
+
File: vt,
|
|
80
|
+
Folder: bt,
|
|
81
|
+
Paperclip: xt,
|
|
82
|
+
Calendar: wt,
|
|
83
|
+
Clock: yt,
|
|
84
|
+
Copy: gt,
|
|
85
|
+
Clipboard: ht,
|
|
86
|
+
MoreHorizontal: mt,
|
|
87
|
+
MoreVertical: pt
|
|
87
88
|
};
|
|
88
|
-
function
|
|
89
|
-
return /* @__PURE__ */
|
|
89
|
+
function qe({ awaiting: n, dark: i }) {
|
|
90
|
+
return /* @__PURE__ */ x(
|
|
90
91
|
"span",
|
|
91
92
|
{
|
|
92
|
-
className: `text-[12px] font-normal italic ${
|
|
93
|
+
className: `text-[12px] font-normal italic ${i ? "text-slate-400" : "text-slate-400 dark:text-slate-500"}`,
|
|
93
94
|
"data-widget-awaiting": n,
|
|
94
95
|
"data-tip": `Waiting for ${n} — this figure is scoped to it and shows once it is set`,
|
|
95
96
|
children: [
|
|
@@ -99,32 +100,32 @@ function Re({ awaiting: n, dark: a }) {
|
|
|
99
100
|
}
|
|
100
101
|
);
|
|
101
102
|
}
|
|
102
|
-
function
|
|
103
|
+
function Re({
|
|
103
104
|
label: n,
|
|
104
|
-
value:
|
|
105
|
-
display:
|
|
106
|
-
loading:
|
|
107
|
-
awaiting:
|
|
105
|
+
value: i,
|
|
106
|
+
display: a,
|
|
107
|
+
loading: l,
|
|
108
|
+
awaiting: u
|
|
108
109
|
}) {
|
|
109
|
-
const { prefix: g, suffix: v } =
|
|
110
|
+
const { prefix: g, suffix: v } = fe(i, a), b = l ? null : pe(i, a.format ?? "");
|
|
110
111
|
return (
|
|
111
112
|
// Same label / value vocabulary as a field tile in the record sub-header
|
|
112
113
|
// (lib/header-strip.ts) — the two kinds of cell read as one row.
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ x(
|
|
114
115
|
"div",
|
|
115
116
|
{
|
|
116
|
-
className: `flex h-full min-w-0 flex-col justify-start gap-1 px-4 pt-[9px] pb-2 ${
|
|
117
|
+
className: `flex h-full min-w-0 flex-col justify-start gap-1 px-4 pt-[9px] pb-2 ${Nr} ${Sr}`,
|
|
117
118
|
children: [
|
|
118
|
-
/* @__PURE__ */ t("span", { className:
|
|
119
|
+
/* @__PURE__ */ t("span", { className: Rr, "data-header-label": !0, children: n }),
|
|
119
120
|
/* @__PURE__ */ t(
|
|
120
121
|
"span",
|
|
121
122
|
{
|
|
122
123
|
"data-header-value": !0,
|
|
123
|
-
className: `${
|
|
124
|
-
children:
|
|
124
|
+
className: `${Lr} max-w-[232px] items-baseline truncate leading-tight`,
|
|
125
|
+
children: l ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : u && i == null ? /* @__PURE__ */ t(qe, { awaiting: u }) : /* @__PURE__ */ x(
|
|
125
126
|
"span",
|
|
126
127
|
{
|
|
127
|
-
className: String(
|
|
128
|
+
className: String(a.format ?? "").startsWith("currency") || /^[$€£¥]/.test(g) ? Cr : $r,
|
|
128
129
|
children: [
|
|
129
130
|
g,
|
|
130
131
|
b,
|
|
@@ -139,34 +140,34 @@ function be({
|
|
|
139
140
|
)
|
|
140
141
|
);
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
+
function Mr({
|
|
143
144
|
data: n,
|
|
144
|
-
label:
|
|
145
|
-
loading:
|
|
146
|
-
widgetConfig:
|
|
147
|
-
awaiting:
|
|
145
|
+
label: i,
|
|
146
|
+
loading: a,
|
|
147
|
+
widgetConfig: l,
|
|
148
|
+
awaiting: u
|
|
148
149
|
}) {
|
|
149
150
|
const g = "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";
|
|
150
151
|
if (n && "values" in n) {
|
|
151
152
|
const b = n.values ?? [];
|
|
152
153
|
return b.length === 0 ? null : /* @__PURE__ */ t("div", { className: g, children: b.map((_, R) => /* @__PURE__ */ t(
|
|
153
|
-
|
|
154
|
+
Re,
|
|
154
155
|
{
|
|
155
156
|
label: _.label,
|
|
156
157
|
value: _.value,
|
|
157
158
|
display: _.display ?? {},
|
|
158
159
|
loading: !1,
|
|
159
|
-
awaiting:
|
|
160
|
+
awaiting: u
|
|
160
161
|
},
|
|
161
162
|
R
|
|
162
163
|
)) });
|
|
163
164
|
}
|
|
164
|
-
if (
|
|
165
|
-
const b = (
|
|
165
|
+
if (a) {
|
|
166
|
+
const b = (l == null ? void 0 : l.value_fields) ?? [], _ = b.length > 0 ? b : [{ label: i }];
|
|
166
167
|
return /* @__PURE__ */ t("div", { className: g, children: _.map((R, C) => /* @__PURE__ */ t(
|
|
167
|
-
|
|
168
|
+
Re,
|
|
168
169
|
{
|
|
169
|
-
label: R.label ??
|
|
170
|
+
label: R.label ?? i,
|
|
170
171
|
display: { prefix: R.prefix ?? "", suffix: R.suffix ?? "", format: R.format ?? "" },
|
|
171
172
|
loading: !0
|
|
172
173
|
},
|
|
@@ -176,99 +177,99 @@ function Tr({
|
|
|
176
177
|
if (!n) return null;
|
|
177
178
|
const v = n.display ?? {};
|
|
178
179
|
return /* @__PURE__ */ t("div", { className: g, children: /* @__PURE__ */ t(
|
|
179
|
-
|
|
180
|
+
Re,
|
|
180
181
|
{
|
|
181
|
-
label:
|
|
182
|
+
label: i,
|
|
182
183
|
value: n.value,
|
|
183
184
|
display: v,
|
|
184
185
|
loading: !1,
|
|
185
|
-
awaiting:
|
|
186
|
+
awaiting: u
|
|
186
187
|
}
|
|
187
188
|
) });
|
|
188
189
|
}
|
|
189
|
-
function
|
|
190
|
-
if (Object.hasOwn(n,
|
|
191
|
-
const
|
|
192
|
-
let
|
|
193
|
-
for (const
|
|
194
|
-
if (
|
|
195
|
-
|
|
190
|
+
function Hr(n, i) {
|
|
191
|
+
if (Object.hasOwn(n, i)) return n[i] ?? null;
|
|
192
|
+
const a = i.split(".");
|
|
193
|
+
let l = n;
|
|
194
|
+
for (const u of a) {
|
|
195
|
+
if (l == null || typeof l != "object") return l ?? null;
|
|
196
|
+
l = l[u];
|
|
196
197
|
}
|
|
197
|
-
return
|
|
198
|
+
return l ?? null;
|
|
198
199
|
}
|
|
199
|
-
function
|
|
200
|
-
const
|
|
201
|
-
for (const
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
else if (
|
|
205
|
-
|
|
206
|
-
else if (
|
|
207
|
-
const
|
|
208
|
-
|
|
200
|
+
function Br(n, i) {
|
|
201
|
+
const a = {};
|
|
202
|
+
for (const l of n)
|
|
203
|
+
if (l.binding_type === "item_field")
|
|
204
|
+
a[l.key] = Hr(i, l.binding_value);
|
|
205
|
+
else if (l.binding_type === "static")
|
|
206
|
+
a[l.key] = l.binding_value;
|
|
207
|
+
else if (l.binding_type === "url_param" && typeof window < "u") {
|
|
208
|
+
const u = new URLSearchParams(window.location.search);
|
|
209
|
+
a[l.key] = u.get(l.binding_value) ?? null;
|
|
209
210
|
}
|
|
210
|
-
return
|
|
211
|
+
return a;
|
|
211
212
|
}
|
|
212
|
-
function
|
|
213
|
+
function Le({
|
|
213
214
|
data: n,
|
|
214
|
-
awaiting:
|
|
215
|
+
awaiting: i
|
|
215
216
|
}) {
|
|
216
|
-
if (
|
|
217
|
-
const
|
|
218
|
-
return /* @__PURE__ */
|
|
219
|
-
|
|
217
|
+
if (i && n.value == null) return /* @__PURE__ */ t(qe, { awaiting: i });
|
|
218
|
+
const a = n.display ?? {}, { prefix: l, suffix: u } = fe(n.value, a), g = pe(n.value, a.format ?? "");
|
|
219
|
+
return /* @__PURE__ */ x("div", { className: "flex items-baseline gap-1", children: [
|
|
220
|
+
l && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: l }),
|
|
220
221
|
/* @__PURE__ */ t("span", { className: "text-2xl font-semibold text-slate-900 dark:text-slate-100", children: g }),
|
|
221
|
-
|
|
222
|
+
u && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: u })
|
|
222
223
|
] });
|
|
223
224
|
}
|
|
224
|
-
function
|
|
225
|
+
function Ce({
|
|
225
226
|
label: n,
|
|
226
|
-
value:
|
|
227
|
-
display:
|
|
228
|
-
dark:
|
|
229
|
-
loading:
|
|
227
|
+
value: i,
|
|
228
|
+
display: a,
|
|
229
|
+
dark: l,
|
|
230
|
+
loading: u,
|
|
230
231
|
awaiting: g
|
|
231
232
|
}) {
|
|
232
|
-
const { prefix: v, suffix: b } =
|
|
233
|
-
return /* @__PURE__ */
|
|
233
|
+
const { prefix: v, suffix: b } = fe(i, a), _ = u ? null : pe(i, a.format ?? "");
|
|
234
|
+
return /* @__PURE__ */ x("div", { className: "flex flex-col justify-center px-2.5 py-1 min-w-0 gap-0.5", children: [
|
|
234
235
|
/* @__PURE__ */ t(
|
|
235
236
|
"span",
|
|
236
237
|
{
|
|
237
|
-
className: `text-[9px] font-medium uppercase tracking-wider leading-none truncate ${
|
|
238
|
+
className: `text-[9px] font-medium uppercase tracking-wider leading-none truncate ${l ? "text-slate-500" : "text-slate-400"}`,
|
|
238
239
|
children: n
|
|
239
240
|
}
|
|
240
241
|
),
|
|
241
242
|
/* @__PURE__ */ t(
|
|
242
243
|
"span",
|
|
243
244
|
{
|
|
244
|
-
className: `flex items-baseline gap-0.5 text-[13px] font-semibold tabular-nums leading-none ${
|
|
245
|
-
children:
|
|
245
|
+
className: `flex items-baseline gap-0.5 text-[13px] font-semibold tabular-nums leading-none ${l ? "text-slate-100" : "text-slate-900"}`,
|
|
246
|
+
children: u ? /* @__PURE__ */ t(
|
|
246
247
|
"span",
|
|
247
248
|
{
|
|
248
|
-
className: `animate-pulse inline-block h-3 w-14 rounded ${
|
|
249
|
+
className: `animate-pulse inline-block h-3 w-14 rounded ${l ? "bg-slate-600" : "bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]"}`
|
|
249
250
|
}
|
|
250
|
-
) : g &&
|
|
251
|
-
v && /* @__PURE__ */ t("span", { className: `text-[10px] ${
|
|
251
|
+
) : g && i == null ? /* @__PURE__ */ t(qe, { awaiting: g, dark: l }) : /* @__PURE__ */ x(Ee, { children: [
|
|
252
|
+
v && /* @__PURE__ */ t("span", { className: `text-[10px] ${l ? "text-slate-400" : "text-slate-500"}`, children: v }),
|
|
252
253
|
_,
|
|
253
|
-
b && /* @__PURE__ */ t("span", { className: `text-[10px] ${
|
|
254
|
+
b && /* @__PURE__ */ t("span", { className: `text-[10px] ${l ? "text-slate-400" : "text-slate-500"}`, children: b })
|
|
254
255
|
] })
|
|
255
256
|
}
|
|
256
257
|
)
|
|
257
258
|
] });
|
|
258
259
|
}
|
|
259
|
-
function
|
|
260
|
+
function Vr({
|
|
260
261
|
data: n,
|
|
261
|
-
label:
|
|
262
|
-
style:
|
|
263
|
-
loading:
|
|
264
|
-
widgetConfig:
|
|
262
|
+
label: i,
|
|
263
|
+
style: a,
|
|
264
|
+
loading: l,
|
|
265
|
+
widgetConfig: u,
|
|
265
266
|
awaiting: g
|
|
266
267
|
}) {
|
|
267
|
-
const v =
|
|
268
|
+
const v = a === "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";
|
|
268
269
|
if (n && "values" in n) {
|
|
269
270
|
const R = n.values ?? [];
|
|
270
271
|
return R.length === 0 ? null : /* @__PURE__ */ t("div", { className: b, children: R.map((C, S) => /* @__PURE__ */ t(
|
|
271
|
-
|
|
272
|
+
Ce,
|
|
272
273
|
{
|
|
273
274
|
label: C.label,
|
|
274
275
|
value: C.value,
|
|
@@ -280,12 +281,12 @@ function Or({
|
|
|
280
281
|
S
|
|
281
282
|
)) });
|
|
282
283
|
}
|
|
283
|
-
if (
|
|
284
|
-
const R = (
|
|
284
|
+
if (l) {
|
|
285
|
+
const R = (u == null ? void 0 : u.value_fields) ?? [], C = R.length > 0 ? R : [{ label: i }];
|
|
285
286
|
return /* @__PURE__ */ t("div", { className: b, children: C.map((S, U) => /* @__PURE__ */ t(
|
|
286
|
-
|
|
287
|
+
Ce,
|
|
287
288
|
{
|
|
288
|
-
label: S.label ??
|
|
289
|
+
label: S.label ?? i,
|
|
289
290
|
display: { prefix: S.prefix ?? "", suffix: S.suffix ?? "", format: S.format ?? "" },
|
|
290
291
|
dark: v,
|
|
291
292
|
loading: !0
|
|
@@ -296,9 +297,9 @@ function Or({
|
|
|
296
297
|
if (!n) return null;
|
|
297
298
|
const _ = n.display ?? {};
|
|
298
299
|
return /* @__PURE__ */ t("div", { className: b, children: /* @__PURE__ */ t(
|
|
299
|
-
|
|
300
|
+
Ce,
|
|
300
301
|
{
|
|
301
|
-
label:
|
|
302
|
+
label: i,
|
|
302
303
|
value: n.value,
|
|
303
304
|
display: _,
|
|
304
305
|
dark: v,
|
|
@@ -307,46 +308,46 @@ function Or({
|
|
|
307
308
|
}
|
|
308
309
|
) });
|
|
309
310
|
}
|
|
310
|
-
function
|
|
311
|
-
const
|
|
312
|
-
return
|
|
311
|
+
function rt({ data: n }) {
|
|
312
|
+
const i = n.values ?? [];
|
|
313
|
+
return i.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No values" }) : /* @__PURE__ */ t(
|
|
313
314
|
"div",
|
|
314
315
|
{
|
|
315
316
|
className: "grid gap-3",
|
|
316
|
-
style: { gridTemplateColumns: `repeat(${Math.min(
|
|
317
|
-
children:
|
|
317
|
+
style: { gridTemplateColumns: `repeat(${Math.min(i.length, 3)}, minmax(0, 1fr))` },
|
|
318
|
+
children: i.map((a, l) => {
|
|
318
319
|
var b;
|
|
319
|
-
const { prefix:
|
|
320
|
-
return /* @__PURE__ */
|
|
321
|
-
|
|
322
|
-
/* @__PURE__ */
|
|
323
|
-
|
|
324
|
-
/* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children:
|
|
320
|
+
const { prefix: u, suffix: g } = fe(a.value, a.display), v = ((b = a.display) == null ? void 0 : b.format) ?? "";
|
|
321
|
+
return /* @__PURE__ */ x("div", { className: "flex flex-col gap-0.5", children: [
|
|
322
|
+
a.label && /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: a.label }),
|
|
323
|
+
/* @__PURE__ */ x("div", { className: "flex items-baseline gap-0.5", children: [
|
|
324
|
+
u && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: u }),
|
|
325
|
+
/* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children: pe(a.value, v) }),
|
|
325
326
|
g && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: g })
|
|
326
327
|
] })
|
|
327
|
-
] },
|
|
328
|
+
] }, l);
|
|
328
329
|
})
|
|
329
330
|
}
|
|
330
331
|
);
|
|
331
332
|
}
|
|
332
|
-
function
|
|
333
|
-
const
|
|
334
|
-
return
|
|
335
|
-
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children:
|
|
336
|
-
/* @__PURE__ */ t("tbody", { children:
|
|
333
|
+
function Fr({ data: n }) {
|
|
334
|
+
const i = n.rows ?? [], a = n.fields ?? [];
|
|
335
|
+
return i.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: [
|
|
336
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children: a.map((l) => /* @__PURE__ */ t("th", { className: "py-1 pr-3 text-left font-medium text-slate-500", children: l }, l)) }) }),
|
|
337
|
+
/* @__PURE__ */ t("tbody", { children: i.map((l, u) => /* @__PURE__ */ t("tr", { className: "border-b border-slate-50", children: a.map((g) => /* @__PURE__ */ t("td", { className: "py-1 pr-3 text-slate-700", children: String(l[g] ?? "") }, g)) }, u)) })
|
|
337
338
|
] }) });
|
|
338
339
|
}
|
|
339
|
-
function
|
|
340
|
+
function nt({
|
|
340
341
|
data: n,
|
|
341
|
-
widgetId:
|
|
342
|
-
inputs:
|
|
343
|
-
apiBase:
|
|
344
|
-
onAction:
|
|
342
|
+
widgetId: i,
|
|
343
|
+
inputs: a,
|
|
344
|
+
apiBase: l,
|
|
345
|
+
onAction: u
|
|
345
346
|
}) {
|
|
346
|
-
const g = n.buttons ?? [], [v, b] =
|
|
347
|
+
const g = n.buttons ?? [], [v, b] = B(null), _ = Te(), R = async (C) => {
|
|
347
348
|
b(C);
|
|
348
349
|
try {
|
|
349
|
-
const S = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "",
|
|
350
|
+
const S = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", E = (await (await fetch(`${l}/widgets-internal/${i}/action`, {
|
|
350
351
|
method: "POST",
|
|
351
352
|
headers: {
|
|
352
353
|
"Content-Type": "application/json",
|
|
@@ -354,26 +355,26 @@ function ze({
|
|
|
354
355
|
...S ? { "x-workspace": S } : {}
|
|
355
356
|
},
|
|
356
357
|
credentials: _.credentials,
|
|
357
|
-
body: JSON.stringify({ button_index: C, inputs:
|
|
358
|
+
body: JSON.stringify({ button_index: C, inputs: a })
|
|
358
359
|
})).json()).data;
|
|
359
|
-
if (
|
|
360
|
+
if (E != null && E.redirect_url)
|
|
360
361
|
try {
|
|
361
|
-
const
|
|
362
|
-
|
|
362
|
+
const T = new URL(E.redirect_url, window.location.origin);
|
|
363
|
+
T.origin === window.location.origin && (window.location.href = T.toString());
|
|
363
364
|
} catch {
|
|
364
365
|
}
|
|
365
|
-
|
|
366
|
+
u == null || u(E);
|
|
366
367
|
} finally {
|
|
367
368
|
b(null);
|
|
368
369
|
}
|
|
369
370
|
};
|
|
370
371
|
return /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: g.map((C, S) => {
|
|
371
|
-
const U = C.style ?? "secondary", A = "inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-[12px] font-medium transition-colors disabled:opacity-50",
|
|
372
|
+
const U = C.style ?? "secondary", A = "inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-[12px] font-medium transition-colors disabled:opacity-50", E = U === "primary" ? `${A} bg-nvr-cyan text-white hover:bg-nvr-cyan/90` : U === "danger" ? `${A} bg-red-500 text-white hover:bg-red-600` : `${A} border border-slate-200 bg-white text-slate-700 hover:bg-slate-50`;
|
|
372
373
|
return /* @__PURE__ */ t(
|
|
373
374
|
"button",
|
|
374
375
|
{
|
|
375
376
|
type: "button",
|
|
376
|
-
className:
|
|
377
|
+
className: E,
|
|
377
378
|
disabled: v !== null,
|
|
378
379
|
onClick: () => R(S),
|
|
379
380
|
children: v === S ? "…" : String(C.label ?? `Action ${S + 1}`)
|
|
@@ -382,29 +383,29 @@ function ze({
|
|
|
382
383
|
);
|
|
383
384
|
}) });
|
|
384
385
|
}
|
|
385
|
-
const
|
|
386
|
-
function
|
|
386
|
+
const Kr = /* @__PURE__ */ new Set(["navigate", "field-update", "flow", "toggle"]);
|
|
387
|
+
function $e({
|
|
387
388
|
buttons: n,
|
|
388
|
-
layout:
|
|
389
|
-
widgetId:
|
|
390
|
-
inputs:
|
|
391
|
-
apiBase:
|
|
389
|
+
layout: i,
|
|
390
|
+
widgetId: a,
|
|
391
|
+
inputs: l,
|
|
392
|
+
apiBase: u,
|
|
392
393
|
onClientAction: g
|
|
393
394
|
}) {
|
|
394
|
-
const [v, b] =
|
|
395
|
-
function
|
|
395
|
+
const [v, b] = B(null), [_, R] = B(null), [C, S] = B({}), U = F(null), A = Te();
|
|
396
|
+
function E(e) {
|
|
396
397
|
return e === !0 || e === 1 ? "1" : e === !1 || e === 0 ? "0" : String(e ?? "");
|
|
397
398
|
}
|
|
398
|
-
function
|
|
399
|
-
const
|
|
400
|
-
return C[
|
|
399
|
+
function T(e, f) {
|
|
400
|
+
const d = e.id ?? String(f);
|
|
401
|
+
return C[d] !== void 0 ? C[d] : e.is_on !== void 0 ? e.is_on : E(l[e.toggle_input ?? ""]) === E(e.toggle_on_value ?? "1");
|
|
401
402
|
}
|
|
402
|
-
function
|
|
403
|
+
function K(e, f) {
|
|
403
404
|
if (e.action !== "toggle") return e.label ?? `Action ${f + 1}`;
|
|
404
|
-
const
|
|
405
|
-
return
|
|
405
|
+
const d = e.action_config, p = e.toggle_input || (d == null ? void 0 : d.toggle_input) || (d == null ? void 0 : d.field) || "", q = p && p !== e.toggle_input ? { ...e, toggle_input: p } : e;
|
|
406
|
+
return T(q, f) ? e.label_on || e.label || `Action ${f + 1}` : e.label_off || e.label || `Action ${f + 1}`;
|
|
406
407
|
}
|
|
407
|
-
function
|
|
408
|
+
function me(e) {
|
|
408
409
|
try {
|
|
409
410
|
if (e.startsWith("/") && !e.startsWith("//")) return e;
|
|
410
411
|
const f = new URL(e, window.location.origin);
|
|
@@ -414,10 +415,10 @@ function Ne({
|
|
|
414
415
|
}
|
|
415
416
|
}
|
|
416
417
|
async function r(e, f) {
|
|
417
|
-
const
|
|
418
|
-
R(
|
|
418
|
+
const d = e.id ?? String(f);
|
|
419
|
+
R(d);
|
|
419
420
|
try {
|
|
420
|
-
const p = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "",
|
|
421
|
+
const p = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", w = (await (await fetch(`${u}/widgets-internal/${a}/action`, {
|
|
421
422
|
method: "POST",
|
|
422
423
|
headers: {
|
|
423
424
|
"Content-Type": "application/json",
|
|
@@ -425,109 +426,109 @@ function Ne({
|
|
|
425
426
|
...p ? { "x-workspace": p } : {}
|
|
426
427
|
},
|
|
427
428
|
credentials: A.credentials,
|
|
428
|
-
body: JSON.stringify({ button_index: f, inputs:
|
|
429
|
+
body: JSON.stringify({ button_index: f, inputs: l })
|
|
429
430
|
})).json()).data;
|
|
430
|
-
if (
|
|
431
|
+
if (w != null && w.redirect_url)
|
|
431
432
|
try {
|
|
432
|
-
const
|
|
433
|
-
|
|
433
|
+
const k = new URL(w.redirect_url, window.location.origin);
|
|
434
|
+
k.origin === window.location.origin && (window.location.href = k.toString());
|
|
434
435
|
} catch {
|
|
435
436
|
}
|
|
436
437
|
} finally {
|
|
437
438
|
R(null);
|
|
438
439
|
}
|
|
439
440
|
}
|
|
440
|
-
function
|
|
441
|
-
const
|
|
442
|
-
if (
|
|
443
|
-
if (
|
|
441
|
+
function Z(e, f) {
|
|
442
|
+
const d = e.action ?? "open-url";
|
|
443
|
+
if (Kr.has(d)) {
|
|
444
|
+
if (d === "toggle") {
|
|
444
445
|
const p = e.id ?? String(f);
|
|
445
|
-
S((
|
|
446
|
+
S((q) => ({ ...q, [p]: !T(e, f) }));
|
|
446
447
|
}
|
|
447
448
|
r(e, f);
|
|
448
449
|
return;
|
|
449
450
|
}
|
|
450
|
-
if (
|
|
451
|
-
const p =
|
|
451
|
+
if (d === "open-url" && e.url) {
|
|
452
|
+
const p = me(e.url);
|
|
452
453
|
if (!p) return;
|
|
453
454
|
e.new_tab ? window.open(p, "_blank", "noopener,noreferrer") : window.location.href = p;
|
|
454
|
-
} else if (
|
|
455
|
+
} else if (d === "email") {
|
|
455
456
|
const p = [];
|
|
456
457
|
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("&")}` : ""}`;
|
|
457
|
-
} else if (
|
|
458
|
+
} else if (d === "copy") {
|
|
458
459
|
const p = e.copy_value ?? "";
|
|
459
460
|
navigator.clipboard.writeText(p).then(() => {
|
|
460
461
|
b(e.id ?? String(f)), U.current && clearTimeout(U.current), U.current = setTimeout(() => b(null), 1800);
|
|
461
462
|
});
|
|
462
|
-
} else
|
|
463
|
+
} else d === "open-sidebar" && e.sidebar_collection && e.sidebar_id && (g == null || g({
|
|
463
464
|
type: "open-sidebar",
|
|
464
465
|
collection: e.sidebar_collection,
|
|
465
466
|
itemId: e.sidebar_id
|
|
466
467
|
}));
|
|
467
468
|
}
|
|
468
|
-
function
|
|
469
|
+
function o(e) {
|
|
469
470
|
const f = e.replace("#", "");
|
|
470
471
|
if (f.length < 6) return !0;
|
|
471
|
-
const
|
|
472
|
-
return (
|
|
472
|
+
const d = parseInt(f.slice(0, 2), 16), p = parseInt(f.slice(2, 4), 16), q = parseInt(f.slice(4, 6), 16);
|
|
473
|
+
return (d * 299 + p * 587 + q * 114) / 1e3 > 128;
|
|
473
474
|
}
|
|
474
|
-
function
|
|
475
|
-
const p = e.id ?? String(f),
|
|
476
|
-
let
|
|
477
|
-
const M = e.action_config,
|
|
475
|
+
function le(e, f, d) {
|
|
476
|
+
const p = e.id ?? String(f), q = v === p, P = _ === p;
|
|
477
|
+
let w = e.label ?? "Button", k = e.variant ?? "secondary";
|
|
478
|
+
const M = e.action_config, j = e.toggle_input || (M == null ? void 0 : M.toggle_input) || (M == null ? void 0 : M.field) || "";
|
|
478
479
|
if (e.action === "toggle") {
|
|
479
|
-
const
|
|
480
|
-
|
|
480
|
+
const $ = j && j !== e.toggle_input ? { ...e, toggle_input: j } : e, J = T($, f);
|
|
481
|
+
w = J ? e.label_on || w : e.label_off || w, k = J ? e.variant_on ?? k : e.variant_off ?? k;
|
|
481
482
|
}
|
|
482
|
-
const
|
|
483
|
+
const G = e.icon ? te[e.icon] : null, L = e.color ? {
|
|
483
484
|
backgroundColor: e.color,
|
|
484
485
|
borderColor: e.color,
|
|
485
|
-
color:
|
|
486
|
+
color: o(e.color) ? "#1e293b" : "#ffffff"
|
|
486
487
|
} : void 0;
|
|
487
|
-
return /* @__PURE__ */
|
|
488
|
-
|
|
488
|
+
return /* @__PURE__ */ x(
|
|
489
|
+
de,
|
|
489
490
|
{
|
|
490
491
|
type: "button",
|
|
491
|
-
variant:
|
|
492
|
+
variant: k,
|
|
492
493
|
size: "sm",
|
|
493
494
|
className: "h-7 gap-1.5 text-[12px]",
|
|
494
495
|
style: L,
|
|
495
496
|
disabled: _ !== null,
|
|
496
|
-
onClick: () =>
|
|
497
|
+
onClick: () => Z(e, f),
|
|
497
498
|
children: [
|
|
498
|
-
|
|
499
|
-
P ? "…" :
|
|
499
|
+
G && /* @__PURE__ */ t(G, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
500
|
+
P ? "…" : q ? "✓ Copied" : w
|
|
500
501
|
]
|
|
501
502
|
},
|
|
502
503
|
p
|
|
503
504
|
);
|
|
504
505
|
}
|
|
505
506
|
if (n.length === 0) return null;
|
|
506
|
-
if (
|
|
507
|
-
const [e, ...f] = n,
|
|
508
|
-
let P = e.label ?? "Button",
|
|
509
|
-
const
|
|
507
|
+
if (i === "split" && n.length > 1) {
|
|
508
|
+
const [e, ...f] = n, d = e.id ?? "0", p = _ === d, q = e.action === "none" || !e.action;
|
|
509
|
+
let P = e.label ?? "Button", w = e.variant ?? "default";
|
|
510
|
+
const k = e.action_config, M = e.toggle_input || (k == null ? void 0 : k.toggle_input) || (k == null ? void 0 : k.field) || "";
|
|
510
511
|
if (e.action === "toggle" && M) {
|
|
511
|
-
const L = M !== e.toggle_input ? { ...e, toggle_input: M } : e,
|
|
512
|
-
P =
|
|
512
|
+
const L = M !== e.toggle_input ? { ...e, toggle_input: M } : e, $ = T(L, 0);
|
|
513
|
+
P = $ ? e.label_on || P : e.label_off || P, w = $ ? e.variant_on ?? w : e.variant_off ?? w;
|
|
513
514
|
}
|
|
514
|
-
const
|
|
515
|
+
const j = e.icon ? te[e.icon] : null, G = e.color ? {
|
|
515
516
|
backgroundColor: e.color,
|
|
516
517
|
borderColor: e.color,
|
|
517
|
-
color:
|
|
518
|
+
color: o(e.color) ? "#1e293b" : "#ffffff"
|
|
518
519
|
} : void 0;
|
|
519
|
-
return
|
|
520
|
-
/* @__PURE__ */ t(
|
|
521
|
-
|
|
520
|
+
return q ? /* @__PURE__ */ t("div", { className: "flex items-center", children: /* @__PURE__ */ x(Ye, { children: [
|
|
521
|
+
/* @__PURE__ */ t(Ze, { asChild: !0, children: /* @__PURE__ */ x(
|
|
522
|
+
de,
|
|
522
523
|
{
|
|
523
524
|
type: "button",
|
|
524
|
-
variant:
|
|
525
|
+
variant: w,
|
|
525
526
|
size: "sm",
|
|
526
527
|
className: "h-7 gap-1.5 text-[12px]",
|
|
527
|
-
style:
|
|
528
|
+
style: G,
|
|
528
529
|
disabled: _ !== null,
|
|
529
530
|
children: [
|
|
530
|
-
|
|
531
|
+
j && /* @__PURE__ */ t(j, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
531
532
|
P,
|
|
532
533
|
/* @__PURE__ */ t("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t(
|
|
533
534
|
"path",
|
|
@@ -542,47 +543,47 @@ function Ne({
|
|
|
542
543
|
]
|
|
543
544
|
}
|
|
544
545
|
) }),
|
|
545
|
-
/* @__PURE__ */ t(
|
|
546
|
-
|
|
546
|
+
/* @__PURE__ */ t(et, { align: "end", className: "min-w-[140px]", children: f.map((L, $) => /* @__PURE__ */ x(
|
|
547
|
+
tt,
|
|
547
548
|
{
|
|
548
549
|
className: "cursor-pointer text-[12px]",
|
|
549
|
-
onSelect: () =>
|
|
550
|
+
onSelect: () => Z(L, $ + 1),
|
|
550
551
|
children: [
|
|
551
|
-
L.icon &&
|
|
552
|
-
const J =
|
|
552
|
+
L.icon && te[L.icon] && (() => {
|
|
553
|
+
const J = te[L.icon];
|
|
553
554
|
return /* @__PURE__ */ t(J, { className: "mr-1.5 h-3.5 w-3.5 shrink-0" });
|
|
554
555
|
})(),
|
|
555
|
-
|
|
556
|
+
K(L, $ + 1)
|
|
556
557
|
]
|
|
557
558
|
},
|
|
558
|
-
L.id ??
|
|
559
|
+
L.id ?? $
|
|
559
560
|
)) })
|
|
560
|
-
] }) }) : /* @__PURE__ */
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
-
|
|
561
|
+
] }) }) : /* @__PURE__ */ x("div", { className: "flex items-center", children: [
|
|
562
|
+
/* @__PURE__ */ x(
|
|
563
|
+
de,
|
|
563
564
|
{
|
|
564
565
|
type: "button",
|
|
565
|
-
variant:
|
|
566
|
+
variant: w,
|
|
566
567
|
size: "sm",
|
|
567
568
|
className: "h-7 rounded-r-none text-[12px] gap-1.5 border-r-0",
|
|
568
|
-
style:
|
|
569
|
+
style: G,
|
|
569
570
|
disabled: _ !== null,
|
|
570
|
-
onClick: () =>
|
|
571
|
+
onClick: () => Z(e, 0),
|
|
571
572
|
children: [
|
|
572
|
-
|
|
573
|
-
p ? "…" : v ===
|
|
573
|
+
j && /* @__PURE__ */ t(j, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
574
|
+
p ? "…" : v === d ? "✓ Copied" : P
|
|
574
575
|
]
|
|
575
576
|
}
|
|
576
577
|
),
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
/* @__PURE__ */ t(
|
|
579
|
-
|
|
578
|
+
/* @__PURE__ */ x(Ye, { children: [
|
|
579
|
+
/* @__PURE__ */ t(Ze, { asChild: !0, children: /* @__PURE__ */ t(
|
|
580
|
+
de,
|
|
580
581
|
{
|
|
581
582
|
type: "button",
|
|
582
|
-
variant:
|
|
583
|
+
variant: w,
|
|
583
584
|
size: "sm",
|
|
584
585
|
className: "h-7 rounded-l-none px-1.5 text-[12px]",
|
|
585
|
-
style:
|
|
586
|
+
style: G,
|
|
586
587
|
disabled: _ !== null,
|
|
587
588
|
"aria-label": "More actions",
|
|
588
589
|
children: /* @__PURE__ */ t("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t(
|
|
@@ -597,38 +598,51 @@ function Ne({
|
|
|
597
598
|
) })
|
|
598
599
|
}
|
|
599
600
|
) }),
|
|
600
|
-
/* @__PURE__ */ t(
|
|
601
|
-
|
|
601
|
+
/* @__PURE__ */ t(et, { align: "end", className: "min-w-[140px]", children: f.map((L, $) => /* @__PURE__ */ x(
|
|
602
|
+
tt,
|
|
602
603
|
{
|
|
603
604
|
className: "text-[12px]",
|
|
604
|
-
onSelect: () =>
|
|
605
|
+
onSelect: () => Z(L, $ + 1),
|
|
605
606
|
children: [
|
|
606
|
-
L.icon &&
|
|
607
|
-
const J =
|
|
607
|
+
L.icon && te[L.icon] && (() => {
|
|
608
|
+
const J = te[L.icon];
|
|
608
609
|
return /* @__PURE__ */ t(J, { className: "mr-1.5 h-3.5 w-3.5 shrink-0" });
|
|
609
610
|
})(),
|
|
610
|
-
|
|
611
|
+
K(L, $ + 1)
|
|
611
612
|
]
|
|
612
613
|
},
|
|
613
|
-
L.id ??
|
|
614
|
+
L.id ?? $
|
|
614
615
|
)) })
|
|
615
616
|
] })
|
|
616
617
|
] });
|
|
617
618
|
}
|
|
618
|
-
return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: n.map((e, f) =>
|
|
619
|
+
return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: n.map((e, f) => le(e, f)) });
|
|
619
620
|
}
|
|
620
|
-
function
|
|
621
|
-
var
|
|
622
|
-
if (
|
|
623
|
-
const
|
|
624
|
-
return { next:
|
|
621
|
+
function st(n, i) {
|
|
622
|
+
var l;
|
|
623
|
+
if (i == null) return { next: n, moved: !1 };
|
|
624
|
+
const a = ((l = i == null ? void 0 : i.instance) == null ? void 0 : l.current_state) ?? null;
|
|
625
|
+
return { next: a, moved: n !== void 0 && n !== a };
|
|
625
626
|
}
|
|
626
|
-
|
|
627
|
+
const Gr = 5e3, Jr = /* @__PURE__ */ new Set([
|
|
628
|
+
se.comments,
|
|
629
|
+
se.tasks,
|
|
630
|
+
se.lock,
|
|
631
|
+
se.sla,
|
|
632
|
+
// A move refreshes widgets through the host's pipeline read (hostStepChange below).
|
|
633
|
+
se.state
|
|
634
|
+
]);
|
|
635
|
+
function Qr(n, i) {
|
|
636
|
+
return n.deleted ? !1 : n.changedFields === null ? !0 : n.changedFields.some(
|
|
637
|
+
(a) => a.startsWith("$") ? !Jr.has(a) : !i.has(a)
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
function _n({
|
|
627
641
|
widgetId: n,
|
|
628
|
-
inputBindings:
|
|
629
|
-
itemDraft:
|
|
630
|
-
itemCollection:
|
|
631
|
-
ready:
|
|
642
|
+
inputBindings: i = [],
|
|
643
|
+
itemDraft: a = {},
|
|
644
|
+
itemCollection: l,
|
|
645
|
+
ready: u = !0,
|
|
632
646
|
label: g,
|
|
633
647
|
defaultExpanded: v = !0,
|
|
634
648
|
frameless: b = !1,
|
|
@@ -639,95 +653,125 @@ function on({
|
|
|
639
653
|
onWidgetType: U,
|
|
640
654
|
onContentChange: A
|
|
641
655
|
}) {
|
|
642
|
-
var
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
}, []),
|
|
646
|
-
|
|
647
|
-
var
|
|
648
|
-
const
|
|
649
|
-
if (
|
|
656
|
+
var Fe, Ke;
|
|
657
|
+
const E = Te(), T = _ ?? E.apiBase, [K, me] = Tr(v, !0), [r, Z] = B(null), [o, le] = B(null), [e, f] = B(!0), [d, p] = B(!0), [q, P] = B(!0), [w, k] = B(null), [M, j] = B(0), [G, L] = B(null), $ = F(!1), J = Ne(() => {
|
|
658
|
+
$.current = !0, j((s) => s + 1);
|
|
659
|
+
}, []), Q = F(null), ie = F(void 0), he = F(!1), ae = dt();
|
|
660
|
+
Y(() => {
|
|
661
|
+
var N;
|
|
662
|
+
const s = r == null ? void 0 : r.widget_type;
|
|
663
|
+
if (s !== "rollup" && s !== "review_list" && s !== "custom-query") return;
|
|
650
664
|
let c = null;
|
|
651
|
-
if (
|
|
652
|
-
const h =
|
|
653
|
-
(h == null ? void 0 : h.state.status) === "success" && (
|
|
665
|
+
if (ie.current === void 0 && Q.current != null) {
|
|
666
|
+
const h = ae.getQueryCache().findAll({ queryKey: ["pipeline-instance-lock"] }).find((I) => String(I.queryKey[2]) === String(Q.current));
|
|
667
|
+
(h == null ? void 0 : h.state.status) === "success" && (ie.current = st(void 0, h.state.data).next);
|
|
654
668
|
}
|
|
655
669
|
const m = /* @__PURE__ */ new WeakMap();
|
|
656
|
-
for (const h of
|
|
657
|
-
const
|
|
658
|
-
typeof
|
|
670
|
+
for (const h of ae.getQueryCache().getAll()) {
|
|
671
|
+
const I = (N = h.queryKey) == null ? void 0 : N[0];
|
|
672
|
+
typeof I != "string" || h.state.status !== "success" || (I.startsWith("o2m-rows") || I.startsWith("nested") || I === "match-agg" || I === "m2m-items") && m.set(h, h.state.data);
|
|
659
673
|
}
|
|
660
|
-
const
|
|
661
|
-
var
|
|
662
|
-
if (h.type !== "updated" || ((
|
|
663
|
-
const
|
|
674
|
+
const O = ae.getQueryCache().subscribe((h) => {
|
|
675
|
+
var Ge;
|
|
676
|
+
if (h.type !== "updated" || ((Ge = h.action) == null ? void 0 : Ge.type) !== "success") return;
|
|
677
|
+
const I = h.query.queryKey, W = I == null ? void 0 : I[0];
|
|
664
678
|
if (typeof W != "string") return;
|
|
665
679
|
if (W.startsWith("o2m-rows") || W.startsWith("nested") || W === "match-agg" || W === "m2m-items") {
|
|
666
|
-
const
|
|
667
|
-
if (m.set(h.query, h.query.state.data),
|
|
680
|
+
const ee = m.has(h.query), ke = m.get(h.query);
|
|
681
|
+
if (m.set(h.query, h.query.state.data), ee && ke === h.query.state.data) return;
|
|
668
682
|
}
|
|
669
683
|
if (W === "pipeline-instance-lock") {
|
|
670
|
-
if (
|
|
684
|
+
if (Q.current == null || String(I[2]) !== String(Q.current))
|
|
671
685
|
return;
|
|
672
|
-
const
|
|
673
|
-
if (
|
|
686
|
+
const ee = st(ie.current, h.query.state.data);
|
|
687
|
+
if (ie.current = ee.next, !ee.moved) return;
|
|
674
688
|
c && clearTimeout(c), c = setTimeout(() => {
|
|
675
|
-
|
|
689
|
+
$.current = !0, j((ke) => ke + 1);
|
|
676
690
|
}, 400);
|
|
677
691
|
return;
|
|
678
692
|
}
|
|
679
|
-
!W.startsWith("o2m-rows") && !W.startsWith("nested") && W !== "match-agg" && W !== "m2m-items" || h.query.state.dataUpdateCount <= 1 || W.startsWith("o2m-rows") &&
|
|
693
|
+
!W.startsWith("o2m-rows") && !W.startsWith("nested") && W !== "match-agg" && W !== "m2m-items" || h.query.state.dataUpdateCount <= 1 || W.startsWith("o2m-rows") && Q.current != null && String(I[3]) !== String(Q.current) || (c && clearTimeout(c), c = setTimeout(() => j((ee) => ee + 1), 400));
|
|
680
694
|
});
|
|
681
695
|
return () => {
|
|
682
|
-
c && clearTimeout(c),
|
|
696
|
+
c && clearTimeout(c), O();
|
|
683
697
|
};
|
|
684
|
-
}, [
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
698
|
+
}, [ae, r == null ? void 0 : r.widget_type]);
|
|
699
|
+
const ge = a.id, je = F(/* @__PURE__ */ new Set());
|
|
700
|
+
je.current = new Set(Object.keys(a));
|
|
701
|
+
const at = !!r && (r.widget_type === "rollup" || r.widget_type === "review_list" || r.widget_type === "custom-query" || i.length > 0), ye = F(!1), re = F(null), Oe = F(0), Ie = F(K);
|
|
702
|
+
Ie.current = K;
|
|
703
|
+
const we = Ne(() => {
|
|
704
|
+
if (!Ie.current) {
|
|
705
|
+
ye.current = !0;
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
if (re.current) return;
|
|
709
|
+
const s = Math.max(1200, Oe.current + Gr - Date.now());
|
|
710
|
+
re.current = setTimeout(() => {
|
|
711
|
+
re.current = null, Oe.current = Date.now(), $.current = !0, j((c) => c + 1);
|
|
712
|
+
}, s);
|
|
713
|
+
}, []);
|
|
714
|
+
Er(
|
|
715
|
+
l,
|
|
716
|
+
ge,
|
|
717
|
+
(s) => {
|
|
718
|
+
Qr(s, je.current) && we();
|
|
719
|
+
},
|
|
720
|
+
{ enabled: at && ge != null && ge !== "" }
|
|
721
|
+
), Y(() => {
|
|
722
|
+
K && ye.current && (ye.current = !1, we());
|
|
723
|
+
}, [K, we]), Y(
|
|
724
|
+
() => () => {
|
|
725
|
+
re.current && clearTimeout(re.current);
|
|
726
|
+
},
|
|
727
|
+
[]
|
|
728
|
+
);
|
|
729
|
+
const De = {};
|
|
730
|
+
for (const [s, c] of Object.entries(a))
|
|
731
|
+
s.includes(".") || (c == null || typeof c != "object") && (De[s] = c);
|
|
732
|
+
const D = { ...De, ...Br(i, a) }, xe = Ir(), z = Je(() => {
|
|
733
|
+
if ((r == null ? void 0 : r.widget_type) !== "rollup" || !xe) return null;
|
|
734
|
+
const s = r.config, c = s == null ? void 0 : s.collection;
|
|
691
735
|
if (!c) return null;
|
|
692
736
|
const m = {
|
|
693
737
|
created: [],
|
|
694
738
|
updated: [],
|
|
695
739
|
deleted: []
|
|
696
740
|
};
|
|
697
|
-
for (const
|
|
698
|
-
const
|
|
699
|
-
|
|
741
|
+
for (const O of xe.byGrid.values()) {
|
|
742
|
+
const N = O[c];
|
|
743
|
+
N && (m.created.push(...N.created), m.updated.push(...N.updated), m.deleted.push(...N.deleted));
|
|
700
744
|
}
|
|
701
745
|
return !m.created.length && !m.updated.length && !m.deleted.length ? null : m;
|
|
702
|
-
}, [r,
|
|
703
|
-
() =>
|
|
704
|
-
[
|
|
705
|
-
), y = (
|
|
706
|
-
var
|
|
707
|
-
if (!
|
|
708
|
-
const
|
|
746
|
+
}, [r, xe]), ot = Je(
|
|
747
|
+
() => z ? JSON.stringify(z) : "",
|
|
748
|
+
[z]
|
|
749
|
+
), y = (Fe = r == null ? void 0 : r.config) == null ? void 0 : Fe.drilldown, oe = xr(), be = y != null && y.id_input ? D[y.id_input] : null, ve = !!oe && !!(y != null && y.collection) && be != null && be !== "", Ae = async () => {
|
|
750
|
+
var O, N;
|
|
751
|
+
if (!ve || !(y != null && y.collection)) return;
|
|
752
|
+
const s = String(be);
|
|
709
753
|
let c = null;
|
|
710
|
-
const m = (h) => fetch(`${
|
|
711
|
-
credentials:
|
|
712
|
-
headers:
|
|
754
|
+
const m = (h) => fetch(`${T}${h}`, {
|
|
755
|
+
credentials: E.credentials,
|
|
756
|
+
headers: E.authHeaders
|
|
713
757
|
});
|
|
714
758
|
try {
|
|
715
759
|
if (y.match_field) {
|
|
716
760
|
const h = await m(
|
|
717
761
|
`/items/${y.collection}?filter=${encodeURIComponent(
|
|
718
|
-
JSON.stringify({ [y.match_field]: { _eq:
|
|
762
|
+
JSON.stringify({ [y.match_field]: { _eq: s } })
|
|
719
763
|
)}&fields=id&limit=1`
|
|
720
764
|
);
|
|
721
765
|
if (h.ok) {
|
|
722
|
-
const
|
|
766
|
+
const I = await h.json(), W = (N = (O = I == null ? void 0 : I.data) == null ? void 0 : O[0]) == null ? void 0 : N.id;
|
|
723
767
|
W != null && (c = String(W));
|
|
724
768
|
}
|
|
725
769
|
}
|
|
726
|
-
c == null && (await m(`/items/${y.collection}/${encodeURIComponent(
|
|
770
|
+
c == null && (await m(`/items/${y.collection}/${encodeURIComponent(s)}?fields=id`)).ok && (c = s);
|
|
727
771
|
} catch {
|
|
728
772
|
return;
|
|
729
773
|
}
|
|
730
|
-
c != null && (
|
|
774
|
+
c != null && (oe == null || oe.open({
|
|
731
775
|
collection: y.collection,
|
|
732
776
|
itemId: c,
|
|
733
777
|
layoutId: y.layout_id ?? null,
|
|
@@ -736,190 +780,190 @@ function on({
|
|
|
736
780
|
}));
|
|
737
781
|
};
|
|
738
782
|
if (D.record_id == null || D.record_id === "") {
|
|
739
|
-
const
|
|
740
|
-
|
|
783
|
+
const s = a.id;
|
|
784
|
+
s != null && s !== "" && (D.record_id = s);
|
|
741
785
|
}
|
|
742
|
-
|
|
743
|
-
const
|
|
744
|
-
function
|
|
745
|
-
const
|
|
786
|
+
Q.current = a.id ?? null;
|
|
787
|
+
const ct = JSON.stringify(D) + (l ?? "") + ot, ut = vr(ct, 400);
|
|
788
|
+
function We() {
|
|
789
|
+
const s = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "";
|
|
746
790
|
return {
|
|
747
791
|
"Content-Type": "application/json",
|
|
748
|
-
|
|
749
|
-
...
|
|
792
|
+
...E.authHeaders,
|
|
793
|
+
...s ? { "x-workspace": s } : {}
|
|
750
794
|
};
|
|
751
795
|
}
|
|
752
|
-
const
|
|
796
|
+
const ne = br(), V = ft({
|
|
753
797
|
queryKey: ["nvr-widget-def", n],
|
|
754
|
-
enabled:
|
|
798
|
+
enabled: u,
|
|
755
799
|
staleTime: 6e4,
|
|
756
800
|
retry: !1,
|
|
757
801
|
queryFn: async () => {
|
|
758
|
-
if (
|
|
759
|
-
return (await
|
|
760
|
-
const
|
|
761
|
-
credentials:
|
|
762
|
-
headers:
|
|
802
|
+
if (ne)
|
|
803
|
+
return (await ne.request(_r(`/widgets-internal/${n}`))).data;
|
|
804
|
+
const s = await fetch(`${T}/widgets-internal/${n}`, {
|
|
805
|
+
credentials: E.credentials,
|
|
806
|
+
headers: We()
|
|
763
807
|
});
|
|
764
|
-
if (!
|
|
765
|
-
return (await
|
|
808
|
+
if (!s.ok) throw Object.assign(new Error("Widget not found"), { status: s.status });
|
|
809
|
+
return (await s.json()).data;
|
|
766
810
|
}
|
|
767
|
-
}),
|
|
768
|
-
|
|
769
|
-
}, [V.error,
|
|
770
|
-
|
|
771
|
-
const
|
|
772
|
-
return window.addEventListener(
|
|
773
|
-
}, []),
|
|
774
|
-
|
|
775
|
-
}, [
|
|
776
|
-
if (!
|
|
777
|
-
const
|
|
778
|
-
if (r.widget_type === "review_list" &&
|
|
811
|
+
}), Ue = V.refetch, _e = Ne(() => {
|
|
812
|
+
k(null), V.error ? Ue() : j((s) => s + 1);
|
|
813
|
+
}, [V.error, Ue]);
|
|
814
|
+
Y(() => {
|
|
815
|
+
const s = () => j((c) => c + 1);
|
|
816
|
+
return window.addEventListener(Qe, s), () => window.removeEventListener(Qe, s);
|
|
817
|
+
}, []), Y(() => {
|
|
818
|
+
u && (V.data ? (Z(V.data), f(!1), k(null), U == null || U(V.data.widget_type)) : V.error && k(ze(V.error, "this widget")));
|
|
819
|
+
}, [u, V.data, V.error]), Y(() => {
|
|
820
|
+
if (!u || !r) return;
|
|
821
|
+
const s = D.record_id == null || D.record_id === "";
|
|
822
|
+
if (r.widget_type === "review_list" && s || r.widget_type === "rollup" && s && !z) return;
|
|
779
823
|
let c = !1;
|
|
780
|
-
return
|
|
824
|
+
return he.current || (p(!0), P(!0)), (async () => {
|
|
781
825
|
try {
|
|
782
826
|
const m = {
|
|
783
|
-
inputs:
|
|
784
|
-
draft:
|
|
785
|
-
bindings:
|
|
786
|
-
item_collection:
|
|
827
|
+
inputs: z ? { ...D, staged: z } : D,
|
|
828
|
+
draft: a,
|
|
829
|
+
bindings: i,
|
|
830
|
+
item_collection: l
|
|
787
831
|
};
|
|
788
|
-
|
|
789
|
-
let
|
|
790
|
-
if (
|
|
791
|
-
|
|
792
|
-
|
|
832
|
+
$.current && (m.refresh = !0, $.current = !1), L(m);
|
|
833
|
+
let O;
|
|
834
|
+
if (ne)
|
|
835
|
+
O = await ne.request(
|
|
836
|
+
kr(`/widgets-internal/${n}/render`, m)
|
|
793
837
|
);
|
|
794
838
|
else {
|
|
795
|
-
const
|
|
839
|
+
const N = await fetch(`${T}/widgets-internal/${n}/render`, {
|
|
796
840
|
method: "POST",
|
|
797
|
-
credentials:
|
|
798
|
-
headers:
|
|
841
|
+
credentials: E.credentials,
|
|
842
|
+
headers: We(),
|
|
799
843
|
body: JSON.stringify(m)
|
|
800
844
|
});
|
|
801
|
-
if (!
|
|
802
|
-
throw Object.assign(new Error("Render failed"), { status:
|
|
803
|
-
|
|
845
|
+
if (!N.ok)
|
|
846
|
+
throw Object.assign(new Error("Render failed"), { status: N.status });
|
|
847
|
+
O = await N.json();
|
|
804
848
|
}
|
|
805
849
|
if (c) return;
|
|
806
|
-
c || (
|
|
850
|
+
c || (he.current = !0, le(O.data), p(!1), k(null));
|
|
807
851
|
} catch (m) {
|
|
808
|
-
c ||
|
|
852
|
+
c || k(ze(m, "this widget"));
|
|
809
853
|
} finally {
|
|
810
854
|
c || P(!1);
|
|
811
855
|
}
|
|
812
856
|
})(), () => {
|
|
813
857
|
c = !0;
|
|
814
858
|
};
|
|
815
|
-
}, [n,
|
|
859
|
+
}, [n, T, ut, u, M, r == null ? void 0 : r.widget_type]), Y(() => {
|
|
816
860
|
if (A) {
|
|
817
|
-
if (
|
|
861
|
+
if (w) {
|
|
818
862
|
A(!0);
|
|
819
863
|
return;
|
|
820
864
|
}
|
|
821
|
-
if (
|
|
865
|
+
if (o) {
|
|
822
866
|
if ((r == null ? void 0 : r.widget_type) === "review_list" || (r == null ? void 0 : r.widget_type) === "rollup") {
|
|
823
|
-
const
|
|
824
|
-
A(Array.isArray(
|
|
867
|
+
const s = o.rows;
|
|
868
|
+
A(Array.isArray(s) && s.length > 0);
|
|
825
869
|
return;
|
|
826
870
|
}
|
|
827
|
-
if ((r == null ? void 0 : r.widget_type) === "custom-query" && "rows" in
|
|
828
|
-
const
|
|
829
|
-
A(Array.isArray(
|
|
871
|
+
if ((r == null ? void 0 : r.widget_type) === "custom-query" && "rows" in o) {
|
|
872
|
+
const s = o.rows;
|
|
873
|
+
A(Array.isArray(s) && s.length > 0);
|
|
830
874
|
return;
|
|
831
875
|
}
|
|
832
876
|
A(!0);
|
|
833
877
|
}
|
|
834
878
|
}
|
|
835
|
-
}, [
|
|
836
|
-
const
|
|
837
|
-
const
|
|
838
|
-
if (!Array.isArray(
|
|
839
|
-
const c =
|
|
840
|
-
const
|
|
841
|
-
return String((
|
|
879
|
+
}, [o, w, r == null ? void 0 : r.widget_type, A]);
|
|
880
|
+
const X = g || (r == null ? void 0 : r.name) || "", ce = (r == null ? void 0 : r.widget_type) === "report_widget" && o ? Ar(o) : o, H = (() => {
|
|
881
|
+
const s = o == null ? void 0 : o.awaiting;
|
|
882
|
+
if (!Array.isArray(s) || s.length === 0) return null;
|
|
883
|
+
const c = s.map((m) => {
|
|
884
|
+
const O = i.find((h) => h.key === m && h.binding_type === "item_field");
|
|
885
|
+
return String((O == null ? void 0 : O.binding_value) ?? m).split(".")[0].replace(/_id$/, "").replace(/_/g, " ").replace(/^\w/, (h) => h.toUpperCase());
|
|
842
886
|
});
|
|
843
887
|
return [...new Set(c)].join(", ");
|
|
844
|
-
})(),
|
|
845
|
-
if ((r == null ? void 0 : r.widget_type) === "review_list" &&
|
|
888
|
+
})(), Pe = D.record_id, Me = Pe == null || Pe === "";
|
|
889
|
+
if ((r == null ? void 0 : r.widget_type) === "review_list" && Me || (r == null ? void 0 : r.widget_type) === "rollup" && Me && !z) return null;
|
|
846
890
|
if (R) {
|
|
847
|
-
const
|
|
848
|
-
if (
|
|
891
|
+
const s = ((Ke = r == null ? void 0 : r.config) == null ? void 0 : Ke.compact_style) ?? "default", c = s === "pill-dark" || s === "pill-light";
|
|
892
|
+
if (w)
|
|
849
893
|
return /* @__PURE__ */ t(
|
|
850
894
|
"button",
|
|
851
895
|
{
|
|
852
896
|
type: "button",
|
|
853
|
-
onClick:
|
|
897
|
+
onClick: _e,
|
|
854
898
|
"data-load-error": "",
|
|
855
|
-
"data-tip": `${
|
|
856
|
-
"aria-label": `${
|
|
899
|
+
"data-tip": `${w} Click to try again.`,
|
|
900
|
+
"aria-label": `${w} Try again`,
|
|
857
901
|
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",
|
|
858
|
-
children: /* @__PURE__ */ t(
|
|
902
|
+
children: /* @__PURE__ */ t(lt, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
859
903
|
}
|
|
860
904
|
);
|
|
861
905
|
if (C) {
|
|
862
906
|
if (e)
|
|
863
|
-
return /* @__PURE__ */
|
|
907
|
+
return /* @__PURE__ */ x("div", { className: "flex h-full w-36 flex-col justify-center px-4 py-2.5", children: [
|
|
864
908
|
/* @__PURE__ */ t("span", { className: "animate-pulse h-2 w-10 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] mb-1" }),
|
|
865
909
|
/* @__PURE__ */ t("span", { className: "animate-pulse h-3.5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
866
910
|
] });
|
|
867
911
|
if (r.widget_type === "button-group")
|
|
868
|
-
return /* @__PURE__ */ t("div", { className: "h-full flex items-center px-3", children:
|
|
869
|
-
|
|
912
|
+
return /* @__PURE__ */ t("div", { className: "h-full flex items-center px-3", children: d ? /* @__PURE__ */ t("div", { className: "animate-pulse h-7 w-24 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : o && /* @__PURE__ */ t(
|
|
913
|
+
$e,
|
|
870
914
|
{
|
|
871
|
-
buttons:
|
|
872
|
-
layout:
|
|
915
|
+
buttons: o.buttons ?? [],
|
|
916
|
+
layout: o.layout ?? "flat",
|
|
873
917
|
widgetId: n,
|
|
874
918
|
inputs: D,
|
|
875
|
-
apiBase:
|
|
919
|
+
apiBase: T,
|
|
876
920
|
onClientAction: S
|
|
877
921
|
}
|
|
878
922
|
) });
|
|
879
923
|
{
|
|
880
924
|
const m = /* @__PURE__ */ t(
|
|
881
|
-
|
|
925
|
+
Mr,
|
|
882
926
|
{
|
|
883
|
-
data:
|
|
927
|
+
data: d ? null : ce ?? null,
|
|
884
928
|
label: g || r.name,
|
|
885
|
-
loading:
|
|
929
|
+
loading: d,
|
|
886
930
|
widgetConfig: r.config,
|
|
887
|
-
awaiting:
|
|
931
|
+
awaiting: H
|
|
888
932
|
}
|
|
889
|
-
),
|
|
933
|
+
), O = ve ? /* @__PURE__ */ t(
|
|
890
934
|
"button",
|
|
891
935
|
{
|
|
892
936
|
type: "button",
|
|
893
|
-
onClick: () => void
|
|
937
|
+
onClick: () => void Ae(),
|
|
894
938
|
title: (y == null ? void 0 : y.title) ?? "Open details",
|
|
895
939
|
className: "h-full w-full cursor-pointer text-left transition-colors hover:bg-nvr-cyan/5",
|
|
896
940
|
"data-nvr-widget-drill": y == null ? void 0 : y.collection,
|
|
897
941
|
children: m
|
|
898
942
|
}
|
|
899
|
-
) : m,
|
|
900
|
-
return
|
|
943
|
+
) : m, N = o == null ? void 0 : o.cache;
|
|
944
|
+
return N != null && N.cache_ttl ? /* @__PURE__ */ x(
|
|
901
945
|
"div",
|
|
902
946
|
{
|
|
903
947
|
className: "group/cache relative h-full w-full",
|
|
904
|
-
"data-cache-stamp":
|
|
948
|
+
"data-cache-stamp": N.cached ? "cached" : "fresh",
|
|
905
949
|
children: [
|
|
906
|
-
|
|
950
|
+
O,
|
|
907
951
|
/* @__PURE__ */ t(
|
|
908
952
|
"button",
|
|
909
953
|
{
|
|
910
954
|
type: "button",
|
|
911
955
|
onClick: J,
|
|
912
|
-
disabled:
|
|
956
|
+
disabled: d,
|
|
913
957
|
"data-cache-refresh": !0,
|
|
914
958
|
"aria-label": "Refresh this figure",
|
|
915
|
-
"data-tip":
|
|
959
|
+
"data-tip": jr(N),
|
|
916
960
|
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",
|
|
917
|
-
children: /* @__PURE__ */ t(
|
|
961
|
+
children: /* @__PURE__ */ t(it, { className: `h-3 w-3 ${d ? "animate-spin" : ""}` })
|
|
918
962
|
}
|
|
919
963
|
)
|
|
920
964
|
]
|
|
921
965
|
}
|
|
922
|
-
) :
|
|
966
|
+
) : O;
|
|
923
967
|
}
|
|
924
968
|
}
|
|
925
969
|
if (c) {
|
|
@@ -927,26 +971,26 @@ function on({
|
|
|
927
971
|
return /* @__PURE__ */ t(
|
|
928
972
|
"div",
|
|
929
973
|
{
|
|
930
|
-
className: `animate-pulse h-8 w-36 rounded-md ${
|
|
974
|
+
className: `animate-pulse h-8 w-36 rounded-md ${s === "pill-dark" ? "bg-slate-700 border border-slate-700" : "bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] border border-slate-200"}`
|
|
931
975
|
}
|
|
932
976
|
);
|
|
933
977
|
{
|
|
934
978
|
const m = /* @__PURE__ */ t(
|
|
935
|
-
|
|
979
|
+
Vr,
|
|
936
980
|
{
|
|
937
|
-
data:
|
|
981
|
+
data: d ? null : ce ?? null,
|
|
938
982
|
label: g || r.name,
|
|
939
|
-
style:
|
|
940
|
-
loading:
|
|
983
|
+
style: s,
|
|
984
|
+
loading: d,
|
|
941
985
|
widgetConfig: r.config,
|
|
942
|
-
awaiting:
|
|
986
|
+
awaiting: H
|
|
943
987
|
}
|
|
944
988
|
);
|
|
945
|
-
return
|
|
989
|
+
return ve ? /* @__PURE__ */ t(
|
|
946
990
|
"button",
|
|
947
991
|
{
|
|
948
992
|
type: "button",
|
|
949
|
-
onClick: () => void
|
|
993
|
+
onClick: () => void Ae(),
|
|
950
994
|
title: (y == null ? void 0 : y.title) ?? "Open details",
|
|
951
995
|
className: "cursor-pointer text-left",
|
|
952
996
|
"data-nvr-widget-drill": y == null ? void 0 : y.collection,
|
|
@@ -955,150 +999,150 @@ function on({
|
|
|
955
999
|
) : m;
|
|
956
1000
|
}
|
|
957
1001
|
}
|
|
958
|
-
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:
|
|
959
|
-
(r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in
|
|
960
|
-
r.widget_type === "report_widget" &&
|
|
961
|
-
r.widget_type === "custom-query" && "values" in
|
|
1002
|
+
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: d ? /* @__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))]" }) }) : o && r && /* @__PURE__ */ x(Ee, { children: [
|
|
1003
|
+
(r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in o) && /* @__PURE__ */ t(Le, { data: o, awaiting: H }),
|
|
1004
|
+
r.widget_type === "report_widget" && ce && /* @__PURE__ */ t(Le, { data: ce, awaiting: H }),
|
|
1005
|
+
r.widget_type === "custom-query" && "values" in o && /* @__PURE__ */ t(rt, { data: o }),
|
|
962
1006
|
r.widget_type === "action-buttons" && /* @__PURE__ */ t(
|
|
963
|
-
|
|
1007
|
+
nt,
|
|
964
1008
|
{
|
|
965
|
-
data:
|
|
1009
|
+
data: o,
|
|
966
1010
|
widgetId: n,
|
|
967
1011
|
inputs: D,
|
|
968
|
-
apiBase:
|
|
1012
|
+
apiBase: T
|
|
969
1013
|
}
|
|
970
1014
|
),
|
|
971
1015
|
r.widget_type === "button-group" && /* @__PURE__ */ t(
|
|
972
|
-
|
|
1016
|
+
$e,
|
|
973
1017
|
{
|
|
974
|
-
buttons:
|
|
975
|
-
layout:
|
|
1018
|
+
buttons: o.buttons ?? [],
|
|
1019
|
+
layout: o.layout ?? "flat",
|
|
976
1020
|
widgetId: n,
|
|
977
1021
|
inputs: D,
|
|
978
|
-
apiBase:
|
|
1022
|
+
apiBase: T,
|
|
979
1023
|
onClientAction: S
|
|
980
1024
|
}
|
|
981
1025
|
)
|
|
982
1026
|
] }) });
|
|
983
1027
|
}
|
|
984
|
-
const
|
|
985
|
-
|
|
1028
|
+
const ue = r == null ? void 0 : r.widget_type, He = ue === "stat" ? /* @__PURE__ */ t(Se, { framed: !1, title: !1, kpi: !0, className: "py-0.5" }) : ue === "list" || ue === "review_list" || ue === "custom-query" ? /* @__PURE__ */ t(Se, { framed: !1, title: !1, lines: 4, className: "py-0.5" }) : /* @__PURE__ */ t(Se, { framed: !1, title: !1, lines: 3, className: "py-0.5" }), Be = ne ? /* @__PURE__ */ t(
|
|
1029
|
+
qr,
|
|
986
1030
|
{
|
|
987
1031
|
className: "mt-2",
|
|
988
|
-
pending:
|
|
989
|
-
request:
|
|
990
|
-
label:
|
|
991
|
-
onResult: (
|
|
992
|
-
const c =
|
|
993
|
-
c && (
|
|
1032
|
+
pending: d && !!r,
|
|
1033
|
+
request: G ? { method: "POST", url: `/widgets-internal/${n}/render`, body: G } : null,
|
|
1034
|
+
label: X || "Widget",
|
|
1035
|
+
onResult: (s) => {
|
|
1036
|
+
const c = s == null ? void 0 : s.data;
|
|
1037
|
+
c && (he.current = !0, le(c), p(!1), P(!1), k(null));
|
|
994
1038
|
},
|
|
995
|
-
onGone: () =>
|
|
1039
|
+
onGone: () => j((s) => s + 1)
|
|
996
1040
|
}
|
|
997
1041
|
) : null;
|
|
998
1042
|
if (b)
|
|
999
|
-
return /* @__PURE__ */
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
!
|
|
1043
|
+
return /* @__PURE__ */ x("div", { children: [
|
|
1044
|
+
q && He,
|
|
1045
|
+
q && Be,
|
|
1046
|
+
w && /* @__PURE__ */ t(Xe, { message: w, onRetry: _e }),
|
|
1047
|
+
!q && !w && o && r && Ve()
|
|
1004
1048
|
] });
|
|
1005
|
-
return /* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1049
|
+
return /* @__PURE__ */ x("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
1050
|
+
/* @__PURE__ */ x(
|
|
1007
1051
|
"button",
|
|
1008
1052
|
{
|
|
1009
1053
|
type: "button",
|
|
1010
1054
|
className: "flex w-full items-center justify-between px-4 py-3 text-left",
|
|
1011
|
-
onClick: () =>
|
|
1055
|
+
onClick: () => me((s) => !s),
|
|
1012
1056
|
children: [
|
|
1013
|
-
/* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children:
|
|
1014
|
-
/* @__PURE__ */ t("span", { className: `text-slate-400 transition-transform ${
|
|
1057
|
+
/* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: X || /* @__PURE__ */ t("span", { className: "inline-block h-3 w-28 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))] align-middle" }) }),
|
|
1058
|
+
/* @__PURE__ */ t("span", { className: `text-slate-400 transition-transform ${K ? "rotate-90" : ""}`, children: "›" })
|
|
1015
1059
|
]
|
|
1016
1060
|
}
|
|
1017
1061
|
),
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
!
|
|
1062
|
+
K && /* @__PURE__ */ x("div", { className: "border-t border-slate-100 px-4 py-3 dark:border-border", children: [
|
|
1063
|
+
q && He,
|
|
1064
|
+
q && Be,
|
|
1065
|
+
w && /* @__PURE__ */ t(Xe, { message: w, onRetry: _e }),
|
|
1066
|
+
!q && !w && o && r && Ve()
|
|
1023
1067
|
] })
|
|
1024
1068
|
] });
|
|
1025
|
-
function
|
|
1026
|
-
var
|
|
1027
|
-
return !
|
|
1028
|
-
(r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in
|
|
1029
|
-
r.widget_type === "custom-query" && "values" in
|
|
1069
|
+
function Ve() {
|
|
1070
|
+
var s;
|
|
1071
|
+
return !o || !r ? null : /* @__PURE__ */ x(Ee, { children: [
|
|
1072
|
+
(r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in o) && /* @__PURE__ */ t(Le, { data: o, awaiting: H }),
|
|
1073
|
+
r.widget_type === "custom-query" && "values" in o && (H ? /* @__PURE__ */ x(
|
|
1030
1074
|
"p",
|
|
1031
1075
|
{
|
|
1032
1076
|
className: "text-[12px] text-slate-500 dark:text-slate-400",
|
|
1033
|
-
"data-widget-awaiting":
|
|
1077
|
+
"data-widget-awaiting": H,
|
|
1034
1078
|
children: [
|
|
1035
1079
|
"Set ",
|
|
1036
|
-
|
|
1080
|
+
H,
|
|
1037
1081
|
" on this record to see ",
|
|
1038
|
-
|
|
1082
|
+
X || "this",
|
|
1039
1083
|
"."
|
|
1040
1084
|
]
|
|
1041
1085
|
}
|
|
1042
|
-
) : /* @__PURE__ */ t(
|
|
1043
|
-
r.widget_type === "list" && /* @__PURE__ */ t(
|
|
1044
|
-
|
|
1086
|
+
) : /* @__PURE__ */ t(rt, { data: o })),
|
|
1087
|
+
r.widget_type === "list" && /* @__PURE__ */ t(Fr, { data: o }),
|
|
1088
|
+
H && r.widget_type === "custom-query" && "rows" in o && /* @__PURE__ */ x(
|
|
1045
1089
|
"p",
|
|
1046
1090
|
{
|
|
1047
1091
|
className: "text-[12px] text-slate-500 dark:text-slate-400",
|
|
1048
|
-
"data-widget-awaiting":
|
|
1092
|
+
"data-widget-awaiting": H,
|
|
1049
1093
|
children: [
|
|
1050
1094
|
"Set ",
|
|
1051
|
-
|
|
1095
|
+
H,
|
|
1052
1096
|
" on this record to see ",
|
|
1053
|
-
|
|
1097
|
+
X || "this",
|
|
1054
1098
|
"."
|
|
1055
1099
|
]
|
|
1056
1100
|
}
|
|
1057
1101
|
),
|
|
1058
|
-
!
|
|
1059
|
-
|
|
1102
|
+
!H && r.widget_type === "custom-query" && "rows" in o && /* @__PURE__ */ t(
|
|
1103
|
+
Dr,
|
|
1060
1104
|
{
|
|
1061
|
-
rows:
|
|
1062
|
-
config: (
|
|
1063
|
-
emptyLabel:
|
|
1105
|
+
rows: o.rows ?? [],
|
|
1106
|
+
config: (s = r.config) == null ? void 0 : s.table,
|
|
1107
|
+
emptyLabel: X
|
|
1064
1108
|
}
|
|
1065
1109
|
),
|
|
1066
1110
|
r.widget_type === "review_list" && /* @__PURE__ */ t(
|
|
1067
|
-
|
|
1111
|
+
Ur,
|
|
1068
1112
|
{
|
|
1069
|
-
data:
|
|
1113
|
+
data: o,
|
|
1070
1114
|
config: r.config ?? {},
|
|
1071
|
-
onRefetch: () =>
|
|
1115
|
+
onRefetch: () => j((c) => c + 1),
|
|
1072
1116
|
hostRecordId: D.record_id,
|
|
1073
|
-
emptyLabel:
|
|
1117
|
+
emptyLabel: X
|
|
1074
1118
|
}
|
|
1075
1119
|
),
|
|
1076
1120
|
r.widget_type === "rollup" && /* @__PURE__ */ t(
|
|
1077
|
-
|
|
1121
|
+
Pr,
|
|
1078
1122
|
{
|
|
1079
|
-
data:
|
|
1123
|
+
data: o,
|
|
1080
1124
|
config: r.config ?? {},
|
|
1081
|
-
emptyLabel:
|
|
1125
|
+
emptyLabel: X
|
|
1082
1126
|
}
|
|
1083
1127
|
),
|
|
1084
|
-
r.widget_type === "report_widget" && /* @__PURE__ */ t(
|
|
1128
|
+
r.widget_type === "report_widget" && /* @__PURE__ */ t(Wr, { payload: o }),
|
|
1085
1129
|
r.widget_type === "action-buttons" && /* @__PURE__ */ t(
|
|
1086
|
-
|
|
1130
|
+
nt,
|
|
1087
1131
|
{
|
|
1088
|
-
data:
|
|
1132
|
+
data: o,
|
|
1089
1133
|
widgetId: n,
|
|
1090
1134
|
inputs: D,
|
|
1091
|
-
apiBase:
|
|
1135
|
+
apiBase: T
|
|
1092
1136
|
}
|
|
1093
1137
|
),
|
|
1094
1138
|
r.widget_type === "button-group" && /* @__PURE__ */ t(
|
|
1095
|
-
|
|
1139
|
+
$e,
|
|
1096
1140
|
{
|
|
1097
|
-
buttons:
|
|
1098
|
-
layout:
|
|
1141
|
+
buttons: o.buttons ?? [],
|
|
1142
|
+
layout: o.layout ?? "flat",
|
|
1099
1143
|
widgetId: n,
|
|
1100
1144
|
inputs: D,
|
|
1101
|
-
apiBase:
|
|
1145
|
+
apiBase: T,
|
|
1102
1146
|
onClientAction: S
|
|
1103
1147
|
}
|
|
1104
1148
|
),
|
|
@@ -1111,13 +1155,14 @@ function on({
|
|
|
1111
1155
|
"review_list",
|
|
1112
1156
|
"rollup",
|
|
1113
1157
|
"report_widget"
|
|
1114
|
-
].includes(r.widget_type) && /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap text-[11px] text-slate-500", children: JSON.stringify(
|
|
1115
|
-
|
|
1116
|
-
|
|
1158
|
+
].includes(r.widget_type) && /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap text-[11px] text-slate-500", children: JSON.stringify(o, null, 2) }),
|
|
1159
|
+
o.cache ? /* @__PURE__ */ t(
|
|
1160
|
+
Or,
|
|
1117
1161
|
{
|
|
1118
|
-
|
|
1162
|
+
scope: `widget:${n}`,
|
|
1163
|
+
envelope: o.cache,
|
|
1119
1164
|
onRefresh: J,
|
|
1120
|
-
refreshing:
|
|
1165
|
+
refreshing: d,
|
|
1121
1166
|
className: "mt-2 justify-end"
|
|
1122
1167
|
}
|
|
1123
1168
|
) : null
|
|
@@ -1125,6 +1170,8 @@ function on({
|
|
|
1125
1170
|
}
|
|
1126
1171
|
}
|
|
1127
1172
|
export {
|
|
1128
|
-
|
|
1129
|
-
|
|
1173
|
+
Gr as LIVE_WIDGET_GAP_MS,
|
|
1174
|
+
_n as WidgetSlot,
|
|
1175
|
+
st as hostStepChange,
|
|
1176
|
+
Qr as widgetLiveRelevant
|
|
1130
1177
|
};
|