@nivaro/react 0.3.114 → 0.3.116
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 +1728 -22
- 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 +4909 -4182
- 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 +612 -551
- 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/OverflowRail.js +326 -0
- 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/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/SignalCard.js +84 -77
- 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/list/PhonePager.js +50 -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 +389 -323
- 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 +2050 -1942
- 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/OwnerAvatars.js +9 -9
- 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 +2407 -1950
- package/dist/shared/components/queue/worklist-helpers.js +10 -6
- 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/ui/popover.js +53 -29
- 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/keep-row-focus.js +43 -0
- 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-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/obligation-banner.js +17 -17
- 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/rail-menu-context.js +9 -0
- 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/row-surface.js +7 -0
- 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/table-pins.js +20 -18
- 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 +62 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-below-md.js +29 -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,29 +1,31 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import { useState as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { useDebounced as
|
|
7
|
-
import { get as
|
|
8
|
-
import { describeError as
|
|
9
|
-
import {
|
|
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
|
-
import {
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { jsx as t, jsxs as h, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as De, useQuery as Y } from "@tanstack/react-query";
|
|
3
|
+
import { useMemo as he, useState as T, useEffect as te, createContext as tt, useRef as ee, useCallback as rt, useContext as nt, useDeferredValue as at } from "react";
|
|
4
|
+
import { createPortal as st } from "react-dom";
|
|
5
|
+
import { useNivaroClient as re, useItemEditAuth as lt, useDrilldown as Ie, useOverlayState as ot, DrilldownContext as it, useItemNavigation as dt } from "../context.js";
|
|
6
|
+
import { useDebounced as ct } from "../hooks/useDebounced.js";
|
|
7
|
+
import { get as xe, post as le } from "../lib/commands.js";
|
|
8
|
+
import { describeError as ut } from "../lib/error-message.js";
|
|
9
|
+
import { liveQueryMeta as mt } from "../lib/live-queries.js";
|
|
10
|
+
import { useLiveFade as pt } from "../lib/live-screen.js";
|
|
11
|
+
import { visiblePageWidgets as ht } from "../lib/page-widget-access.js";
|
|
12
|
+
import { explicitAllUrlParams as xt, initialFilterSelection as ft, filterSelectionToSearch as bt } from "../lib/query-filter-seed.js";
|
|
13
|
+
import { userErrorMessage as ze } from "../lib/safe-error.js";
|
|
14
|
+
import { safeLinkKind as gt } from "../lib/safe-href.js";
|
|
15
|
+
import { resolveSheetDef as yt } from "../lib/sheet-def.js";
|
|
16
|
+
import { uniqueByValue as vt } from "../lib/unique-options.js";
|
|
17
|
+
import { useMyScopes as kt, matchScopeDimension as Oe, effectiveScopeSeedIds as wt, translateScopeValues as Nt } from "../lib/use-my-scopes.js";
|
|
18
|
+
import { titleCase as Q, formatRelative as St, formatNumber as $t } from "../lib/utils.js";
|
|
19
|
+
import { LiveCacheStamp as _t } from "./CacheStamp.js";
|
|
20
|
+
import { RelationCombobox as Ct } from "./item-edit/RelationCombobox.js";
|
|
21
|
+
import { MatrixEditor as fe } from "./MatrixEditor.js";
|
|
22
|
+
import { QueryStatStrip as qt } from "./QueryStatStrip.js";
|
|
23
|
+
import { QueryTable as jt } from "./QueryTable.js";
|
|
24
|
+
import { RecordDrilldownSheet as Tt } from "./RecordDrilldownSheet.js";
|
|
25
|
+
import { RecordGridEditor as Ae } from "./RecordGridEditor.js";
|
|
26
|
+
import { SheetHeaderBody as Mt } from "./SheetHeaderBody.js";
|
|
27
|
+
const me = 76;
|
|
28
|
+
function oe() {
|
|
27
29
|
return /* @__PURE__ */ t("div", { className: "space-y-1.5 p-3", children: [1, 2, 3].map((e) => /* @__PURE__ */ t(
|
|
28
30
|
"div",
|
|
29
31
|
{
|
|
@@ -32,25 +34,25 @@ function ae() {
|
|
|
32
34
|
e
|
|
33
35
|
)) });
|
|
34
36
|
}
|
|
35
|
-
function
|
|
36
|
-
const n =
|
|
37
|
+
function ie({ error: e, unresolved: r }) {
|
|
38
|
+
const n = zt(e, r) ?? ze(e, "Failed to load widget data");
|
|
37
39
|
return /* @__PURE__ */ t("div", { className: "flex h-full items-center justify-center p-3 text-[12px] text-amber-600 dark:text-amber-500", children: n });
|
|
38
40
|
}
|
|
39
|
-
function
|
|
41
|
+
function Rt(e) {
|
|
40
42
|
if (e == null) return "—";
|
|
41
43
|
if (typeof e == "boolean") return e ? "true" : "false";
|
|
42
44
|
const r = String(e);
|
|
43
45
|
return r.length > 80 ? `${r.slice(0, 80)}…` : r;
|
|
44
46
|
}
|
|
45
|
-
function
|
|
46
|
-
const n = [],
|
|
47
|
-
return e.split(
|
|
48
|
-
const
|
|
47
|
+
function pe(e, r) {
|
|
48
|
+
const n = [], s = /(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|\[[^\]]+\]\([^)]+\))/g;
|
|
49
|
+
return e.split(s).forEach((l, m) => {
|
|
50
|
+
const u = `${r}-${m}`;
|
|
49
51
|
if (l)
|
|
50
52
|
if (l.startsWith("**") && l.endsWith("**"))
|
|
51
|
-
n.push(/* @__PURE__ */ t("strong", { children: l.slice(2, -2) },
|
|
53
|
+
n.push(/* @__PURE__ */ t("strong", { children: l.slice(2, -2) }, u));
|
|
52
54
|
else if (l.startsWith("*") && l.endsWith("*") && l.length > 2)
|
|
53
|
-
n.push(/* @__PURE__ */ t("em", { children: l.slice(1, -1) },
|
|
55
|
+
n.push(/* @__PURE__ */ t("em", { children: l.slice(1, -1) }, u));
|
|
54
56
|
else if (l.startsWith("`") && l.endsWith("`"))
|
|
55
57
|
n.push(
|
|
56
58
|
/* @__PURE__ */ t(
|
|
@@ -59,126 +61,133 @@ function ue(e, r) {
|
|
|
59
61
|
className: "rounded bg-slate-100 px-1 py-0.5 font-mono text-[0.9em] dark:bg-muted",
|
|
60
62
|
children: l.slice(1, -1)
|
|
61
63
|
},
|
|
62
|
-
|
|
64
|
+
u
|
|
63
65
|
)
|
|
64
66
|
);
|
|
65
67
|
else {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
/* @__PURE__ */ t("a", { href:
|
|
68
|
+
const d = l.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
|
|
69
|
+
d && gt(d[2]) !== null ? n.push(
|
|
70
|
+
/* @__PURE__ */ t("a", { href: d[2], className: "text-nvr-cyan underline-offset-2 hover:underline", children: d[1] }, u)
|
|
69
71
|
) : n.push(l);
|
|
70
72
|
}
|
|
71
73
|
}), n;
|
|
72
74
|
}
|
|
73
|
-
function
|
|
75
|
+
function Wt({ content: e }) {
|
|
74
76
|
const r = [];
|
|
75
|
-
let n = [],
|
|
76
|
-
const
|
|
77
|
+
let n = [], s = [], l = !1;
|
|
78
|
+
const m = (d) => {
|
|
77
79
|
n.length && (r.push(
|
|
78
|
-
/* @__PURE__ */ t("p", { className: "leading-relaxed", children:
|
|
80
|
+
/* @__PURE__ */ t("p", { className: "leading-relaxed", children: pe(n.join(" "), d) }, d)
|
|
79
81
|
), n = []);
|
|
80
|
-
},
|
|
81
|
-
if (!
|
|
82
|
-
const
|
|
82
|
+
}, u = (d) => {
|
|
83
|
+
if (!s.length) return;
|
|
84
|
+
const o = s.map((c, x) => /* @__PURE__ */ t("li", { children: pe(c, `${d}-${x}`) }, `${d}-${x}`));
|
|
83
85
|
r.push(
|
|
84
|
-
l ? /* @__PURE__ */ t("ol", { className: "list-decimal space-y-0.5 pl-5", children:
|
|
85
|
-
),
|
|
86
|
+
l ? /* @__PURE__ */ t("ol", { className: "list-decimal space-y-0.5 pl-5", children: o }, d) : /* @__PURE__ */ t("ul", { className: "list-disc space-y-0.5 pl-5", children: o }, d)
|
|
87
|
+
), s = [];
|
|
86
88
|
};
|
|
87
89
|
return e.split(`
|
|
88
|
-
`).forEach((
|
|
89
|
-
const
|
|
90
|
+
`).forEach((d, o) => {
|
|
91
|
+
const c = `md-${o}`, x = d.match(/^(#{1,3})\s+(.*)$/), N = d.match(/^[-*]\s+(.*)$/), C = d.match(/^\d+\.\s+(.*)$/);
|
|
90
92
|
if (x) {
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
+
u(`${c}-fl`), m(`${c}-fp`);
|
|
94
|
+
const S = x[1].length, q = S === 1 ? "text-[17px] font-semibold" : S === 2 ? "text-[15px] font-semibold" : "text-[13.5px] font-semibold";
|
|
93
95
|
r.push(
|
|
94
|
-
/* @__PURE__ */ t("div", { className: `${q} text-slate-900 dark:text-slate-100`, children:
|
|
96
|
+
/* @__PURE__ */ t("div", { className: `${q} text-slate-900 dark:text-slate-100`, children: pe(x[2], `${c}-h`) }, c)
|
|
95
97
|
);
|
|
96
|
-
} else if (
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
} else
|
|
101
|
-
}),
|
|
98
|
+
} else if (N || C) {
|
|
99
|
+
m(`${c}-fp`);
|
|
100
|
+
const S = !!C;
|
|
101
|
+
s.length && l !== S && u(`${c}-fl`), l = S, s.push((N == null ? void 0 : N[1]) ?? (C == null ? void 0 : C[1]));
|
|
102
|
+
} else d.trim() === "" ? (u(`${c}-fl`), m(`${c}-fp`)) : (u(`${c}-fl`), n.push(d.trim()));
|
|
103
|
+
}), u("md-end-l"), m("md-end-p"), /* @__PURE__ */ t("div", { className: "space-y-2 p-4 text-[13px] text-slate-700 dark:text-slate-300", children: r });
|
|
102
104
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
const Ke = tt(null);
|
|
106
|
+
function be() {
|
|
107
|
+
const e = nt(Ke);
|
|
108
|
+
return e ? mt(e) : void 0;
|
|
109
|
+
}
|
|
110
|
+
const Pt = /* @__PURE__ */ new Set(["page-renderer-query", "page-renderer-widget-data"]);
|
|
111
|
+
function ge(e, r, n) {
|
|
112
|
+
const s = re();
|
|
113
|
+
return Y({
|
|
106
114
|
queryKey: ["page-renderer-widget-data", e, r.id],
|
|
107
|
-
queryFn: () =>
|
|
115
|
+
queryFn: () => s.request(le(`/pages/${e}/widget-data`, { widget_id: r.id })).then((l) => l.data),
|
|
108
116
|
enabled: n,
|
|
109
117
|
retry: !1,
|
|
110
|
-
staleTime: 3e4
|
|
118
|
+
staleTime: 3e4,
|
|
119
|
+
meta: be()
|
|
111
120
|
});
|
|
112
121
|
}
|
|
113
|
-
function
|
|
114
|
-
var
|
|
115
|
-
const n = r.config ?? {}, { data:
|
|
122
|
+
function Lt({ slug: e, widget: r }) {
|
|
123
|
+
var c;
|
|
124
|
+
const n = r.config ?? {}, { data: s, isLoading: l, error: m } = ge(e, r, !!n.collection), u = dt();
|
|
116
125
|
if (!n.collection)
|
|
117
126
|
return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Select a collection" });
|
|
118
|
-
if (l) return /* @__PURE__ */ t(
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
if (!
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
return
|
|
127
|
+
if (l) return /* @__PURE__ */ t(oe, {});
|
|
128
|
+
if (m) return /* @__PURE__ */ t(ie, { error: m });
|
|
129
|
+
const d = (s == null ? void 0 : s.rows) ?? [];
|
|
130
|
+
if (!d.length) return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "No records" });
|
|
131
|
+
const o = (c = n.columns) != null && c.length ? n.columns : Object.keys(d[0]).filter((x) => {
|
|
132
|
+
const N = d[0][x];
|
|
133
|
+
return N === null || ["string", "number", "boolean"].includes(typeof N);
|
|
125
134
|
}).slice(0, 5);
|
|
126
|
-
return /* @__PURE__ */ t("div", { className: "h-full overflow-auto", children: /* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100 dark:border-border", children:
|
|
135
|
+
return /* @__PURE__ */ t("div", { className: "h-full overflow-auto", children: /* @__PURE__ */ h("table", { className: "w-full text-[12px]", children: [
|
|
136
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100 dark:border-border", children: o.map((x) => /* @__PURE__ */ t(
|
|
128
137
|
"th",
|
|
129
138
|
{
|
|
130
139
|
className: "whitespace-nowrap px-3 py-1.5 text-left font-medium text-slate-400",
|
|
131
|
-
children:
|
|
140
|
+
children: Q(x)
|
|
132
141
|
},
|
|
133
142
|
x
|
|
134
143
|
)) }) }),
|
|
135
|
-
/* @__PURE__ */ t("tbody", { children:
|
|
144
|
+
/* @__PURE__ */ t("tbody", { children: d.map((x, N) => /* @__PURE__ */ t(
|
|
136
145
|
"tr",
|
|
137
146
|
{
|
|
138
|
-
onClick: x.id != null ? () =>
|
|
147
|
+
onClick: x.id != null ? () => u.open({ collection: n.collection, itemId: String(x.id) }) : void 0,
|
|
139
148
|
className: `border-b border-slate-50 last:border-0 dark:border-border/50 ${x.id != null ? "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/40" : ""}`,
|
|
140
|
-
children:
|
|
149
|
+
children: o.map((C) => /* @__PURE__ */ t(
|
|
141
150
|
"td",
|
|
142
151
|
{
|
|
143
152
|
className: "whitespace-nowrap px-3 py-1.5 text-slate-700 dark:text-slate-300",
|
|
144
|
-
children:
|
|
153
|
+
children: Rt(x[C])
|
|
145
154
|
},
|
|
146
|
-
|
|
155
|
+
C
|
|
147
156
|
))
|
|
148
157
|
},
|
|
149
|
-
x.id != null ? `${x.id}-${
|
|
158
|
+
x.id != null ? `${x.id}-${N}` : N
|
|
150
159
|
)) })
|
|
151
160
|
] }) });
|
|
152
161
|
}
|
|
153
|
-
function
|
|
154
|
-
const n = r.config ?? {}, { data:
|
|
155
|
-
return n.collection ?
|
|
156
|
-
l ? /* @__PURE__ */ t("div", { className: "h-9 w-24 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("span", { className: "text-[32px] font-semibold leading-none tracking-tight text-slate-900 dark:text-slate-100", children: (
|
|
162
|
+
function Ot({ slug: e, widget: r }) {
|
|
163
|
+
const n = r.config ?? {}, { data: s, isLoading: l, error: m } = ge(e, r, !!n.collection);
|
|
164
|
+
return n.collection ? m ? /* @__PURE__ */ t(ie, { error: m }) : /* @__PURE__ */ h("div", { className: "flex h-full flex-col items-start justify-center px-4", children: [
|
|
165
|
+
l ? /* @__PURE__ */ t("div", { className: "h-9 w-24 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("span", { className: "text-[32px] font-semibold leading-none tracking-tight text-slate-900 dark:text-slate-100", children: (s == null ? void 0 : s.value) != null ? $t(Number(s.value)) : "—" }),
|
|
157
166
|
/* @__PURE__ */ t("span", { className: "mt-1.5 text-[12px] text-slate-400", children: n.label || `${n.aggregate ?? "count"} of ${n.collection}` })
|
|
158
167
|
] }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Select a collection" });
|
|
159
168
|
}
|
|
160
|
-
function
|
|
161
|
-
const { data: n, isLoading:
|
|
162
|
-
if (
|
|
163
|
-
if (l) return /* @__PURE__ */ t(
|
|
164
|
-
const
|
|
165
|
-
return
|
|
169
|
+
function At({ slug: e, widget: r }) {
|
|
170
|
+
const { data: n, isLoading: s, error: l } = ge(e, r, !0);
|
|
171
|
+
if (s) return /* @__PURE__ */ t(oe, {});
|
|
172
|
+
if (l) return /* @__PURE__ */ t(ie, { error: l });
|
|
173
|
+
const m = (n == null ? void 0 : n.rows) ?? [];
|
|
174
|
+
return m.length ? /* @__PURE__ */ t("div", { className: "h-full overflow-auto px-3 py-1.5", children: m.map((u) => /* @__PURE__ */ h(
|
|
166
175
|
"div",
|
|
167
176
|
{
|
|
168
177
|
className: "flex items-center gap-2 border-b border-slate-50 py-1.5 text-[12px] last:border-0 dark:border-border/50",
|
|
169
178
|
children: [
|
|
170
|
-
/* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-300", children:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
179
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-300", children: u.action }),
|
|
180
|
+
u.collection && /* @__PURE__ */ h("span", { className: "truncate font-mono text-[11px] text-slate-400", children: [
|
|
181
|
+
u.collection,
|
|
182
|
+
u.item ? ` · ${u.item}` : ""
|
|
174
183
|
] }),
|
|
175
|
-
/* @__PURE__ */ t("span", { className: "ml-auto shrink-0 text-[11px] text-slate-400", children:
|
|
184
|
+
/* @__PURE__ */ t("span", { className: "ml-auto shrink-0 text-[11px] text-slate-400", children: St(u.timestamp) })
|
|
176
185
|
]
|
|
177
186
|
},
|
|
178
|
-
|
|
187
|
+
u.id
|
|
179
188
|
)) }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "No activity" });
|
|
180
189
|
}
|
|
181
|
-
function
|
|
190
|
+
function Ft({ widget: e }) {
|
|
182
191
|
var n;
|
|
183
192
|
const r = String(((n = e.config) == null ? void 0 : n.url) ?? "");
|
|
184
193
|
return r ? /^https?:\/\//i.test(r) ? /* @__PURE__ */ t(
|
|
@@ -191,23 +200,23 @@ function jt({ widget: e }) {
|
|
|
191
200
|
}
|
|
192
201
|
) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-amber-600", children: "URL must start with http(s)://" }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Set an iframe URL" });
|
|
193
202
|
}
|
|
194
|
-
function
|
|
203
|
+
function Qe({
|
|
195
204
|
config: e,
|
|
196
205
|
initialScope: r,
|
|
197
206
|
width: n,
|
|
198
|
-
title:
|
|
207
|
+
title: s,
|
|
199
208
|
onClose: l
|
|
200
209
|
}) {
|
|
201
|
-
const
|
|
202
|
-
return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: l, children: /* @__PURE__ */
|
|
210
|
+
const m = typeof n == "number" ? `${n}px` : n ?? "85%";
|
|
211
|
+
return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: l, children: /* @__PURE__ */ h(
|
|
203
212
|
"div",
|
|
204
213
|
{
|
|
205
214
|
className: "flex h-full flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-border dark:bg-background",
|
|
206
|
-
style: { width:
|
|
207
|
-
onClick: (
|
|
215
|
+
style: { width: m, maxWidth: "96%" },
|
|
216
|
+
onClick: (u) => u.stopPropagation(),
|
|
208
217
|
children: [
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children:
|
|
218
|
+
/* @__PURE__ */ h("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
219
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: s ?? e.title ?? "Manage" }),
|
|
211
220
|
/* @__PURE__ */ t(
|
|
212
221
|
"button",
|
|
213
222
|
{
|
|
@@ -218,94 +227,95 @@ function De({
|
|
|
218
227
|
}
|
|
219
228
|
)
|
|
220
229
|
] }),
|
|
221
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(
|
|
230
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(fe, { config: e, initialScope: r }) })
|
|
222
231
|
]
|
|
223
232
|
}
|
|
224
233
|
) });
|
|
225
234
|
}
|
|
226
|
-
function
|
|
227
|
-
const r = e.config ?? {}, [n,
|
|
228
|
-
return !r.target_collection || !r.option_collection || !r.key_field || !r.value_field ? /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Matrix editor not configured" }) : r.display === "drawer" ? /* @__PURE__ */
|
|
235
|
+
function Et({ widget: e }) {
|
|
236
|
+
const r = e.config ?? {}, [n, s] = T(!1);
|
|
237
|
+
return !r.target_collection || !r.option_collection || !r.key_field || !r.value_field ? /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Matrix editor not configured" }) : r.display === "drawer" ? /* @__PURE__ */ h("div", { className: "flex h-full items-center", children: [
|
|
229
238
|
/* @__PURE__ */ t(
|
|
230
239
|
"button",
|
|
231
240
|
{
|
|
232
241
|
type: "button",
|
|
233
|
-
onClick: () =>
|
|
242
|
+
onClick: () => s(!0),
|
|
234
243
|
className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-md border border-slate-200 bg-white px-3 text-[12.5px] font-medium text-slate-700 shadow-sm transition-colors hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:bg-card dark:text-slate-200 dark:hover:text-nvr-cyan",
|
|
235
244
|
children: r.button_label ?? r.title ?? "Manage"
|
|
236
245
|
}
|
|
237
246
|
),
|
|
238
247
|
n && /* @__PURE__ */ t(
|
|
239
|
-
|
|
248
|
+
Qe,
|
|
240
249
|
{
|
|
241
250
|
config: r,
|
|
242
251
|
width: r.sheet_width,
|
|
243
|
-
onClose: () =>
|
|
252
|
+
onClose: () => s(!1)
|
|
244
253
|
}
|
|
245
254
|
)
|
|
246
|
-
] }) : /* @__PURE__ */ t(
|
|
255
|
+
] }) : /* @__PURE__ */ t(fe, { config: r });
|
|
247
256
|
}
|
|
248
|
-
function
|
|
249
|
-
return
|
|
257
|
+
function Bt(e) {
|
|
258
|
+
return ft(
|
|
250
259
|
e,
|
|
251
260
|
typeof window > "u" ? "" : window.location.search
|
|
252
261
|
);
|
|
253
262
|
}
|
|
254
|
-
function
|
|
255
|
-
const n = [...new Set(e.map((
|
|
263
|
+
function Fe(e, r) {
|
|
264
|
+
const n = [...new Set(e.map((s) => s[r]).filter((s) => s != null && s !== ""))];
|
|
256
265
|
return n.length ? n.map(String).join(",") : void 0;
|
|
257
266
|
}
|
|
258
|
-
function
|
|
267
|
+
function Ue(e, r, n, s, l, m, u) {
|
|
259
268
|
if (typeof e != "string") return e;
|
|
260
269
|
if (e.startsWith("$row.")) {
|
|
261
|
-
const
|
|
262
|
-
return !r &&
|
|
270
|
+
const d = e.slice(5);
|
|
271
|
+
return !r && u ? Fe(u, d) : r == null ? void 0 : r[d];
|
|
263
272
|
}
|
|
264
|
-
if (e.startsWith("$rows.")) return
|
|
265
|
-
if (e.startsWith("$param.")) return
|
|
273
|
+
if (e.startsWith("$rows.")) return Fe(n, e.slice(6));
|
|
274
|
+
if (e.startsWith("$param.")) return s[e.slice(7)];
|
|
266
275
|
if (e.startsWith("$filters.")) {
|
|
267
|
-
const
|
|
268
|
-
return
|
|
276
|
+
const d = e.slice(9), o = m == null ? void 0 : m.find((x) => x.param === d), c = l[d] ?? [];
|
|
277
|
+
return c.length ? c.map((x) => String(x[(o == null ? void 0 : o.value_field) ?? "id"] ?? "")).join(",") : void 0;
|
|
269
278
|
}
|
|
270
279
|
return e;
|
|
271
280
|
}
|
|
272
|
-
function
|
|
273
|
-
const
|
|
274
|
-
for (const [
|
|
275
|
-
const
|
|
276
|
-
|
|
281
|
+
function Dt(e, r, n, s, l, m, u) {
|
|
282
|
+
const d = {}, o = [];
|
|
283
|
+
for (const [c, x] of Object.entries(e.params ?? {})) {
|
|
284
|
+
const N = Ue(x, r, n, s, l, m, u);
|
|
285
|
+
N !== void 0 ? d[c] = N : typeof x == "string" && (x.startsWith("$row.") || x.startsWith("$rows.")) && o.push(c);
|
|
277
286
|
}
|
|
278
|
-
return { ...e, params:
|
|
287
|
+
return { ...e, params: d, ...o.length ? { unresolved_params: o } : {} };
|
|
279
288
|
}
|
|
280
|
-
function
|
|
281
|
-
var l,
|
|
289
|
+
function It(e, r) {
|
|
290
|
+
var l, m;
|
|
282
291
|
let n = (l = e.row_noun) == null ? void 0 : l.trim();
|
|
283
292
|
if (!n) {
|
|
284
|
-
const
|
|
285
|
-
n =
|
|
293
|
+
const u = (m = /\{\{\s*([a-z]+)_[\w.]*\s*\}\}/i.exec(e.title ?? "")) == null ? void 0 : m[1];
|
|
294
|
+
n = u ? `${u.toLowerCase()}s` : "rows";
|
|
286
295
|
}
|
|
287
|
-
const
|
|
288
|
-
return `Total of ${r.toLocaleString("en-US")} ${
|
|
296
|
+
const s = r === 1 && n.endsWith("s") ? n.slice(0, -1) : n;
|
|
297
|
+
return `Total of ${r.toLocaleString("en-US")} ${s}`;
|
|
289
298
|
}
|
|
290
|
-
function
|
|
291
|
-
const n =
|
|
299
|
+
function zt(e, r) {
|
|
300
|
+
const n = ut(e), s = [n.title, n.technical ?? ""].join(" "), l = /Missing required parameter:\s*([\w]+)/i.exec(s);
|
|
292
301
|
if (!l) return null;
|
|
293
|
-
const
|
|
294
|
-
return r != null && r.includes(l[1]) ? `Nothing to show: the row you opened has no ${
|
|
302
|
+
const m = Q(l[1]).toLowerCase();
|
|
303
|
+
return r != null && r.includes(l[1]) ? `Nothing to show: the row you opened has no ${m}.` : `Choose ${m} to see this view.`;
|
|
295
304
|
}
|
|
296
|
-
function
|
|
305
|
+
function Kt({
|
|
297
306
|
config: e,
|
|
298
307
|
stats: r,
|
|
299
308
|
asOf: n,
|
|
300
|
-
note:
|
|
309
|
+
note: s
|
|
301
310
|
}) {
|
|
302
|
-
const l =
|
|
311
|
+
const l = re(), m = be(), u = e.params ?? {}, { data: d, isPending: o, isError: c } = Y({
|
|
303
312
|
queryKey: ["page-renderer-query", e.query_slug, JSON.stringify(u)],
|
|
304
313
|
queryFn: () => l.request(
|
|
305
|
-
|
|
314
|
+
le(`/custom-queries/${e.query_slug}/execute`, { params: u })
|
|
306
315
|
),
|
|
307
316
|
enabled: !!e.query_slug,
|
|
308
|
-
staleTime: 6e4
|
|
317
|
+
staleTime: 6e4,
|
|
318
|
+
meta: m
|
|
309
319
|
});
|
|
310
320
|
return /* @__PURE__ */ t(
|
|
311
321
|
"div",
|
|
@@ -313,63 +323,63 @@ function Pt({
|
|
|
313
323
|
className: "shrink-0 border-b border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card",
|
|
314
324
|
"data-sheet-header": !0,
|
|
315
325
|
children: /* @__PURE__ */ t(
|
|
316
|
-
|
|
326
|
+
Mt,
|
|
317
327
|
{
|
|
318
328
|
stats: r,
|
|
319
|
-
rows: (
|
|
329
|
+
rows: (d == null ? void 0 : d.data) ?? [],
|
|
320
330
|
params: u,
|
|
321
|
-
loading: o && !
|
|
322
|
-
error:
|
|
331
|
+
loading: o && !c,
|
|
332
|
+
error: c,
|
|
323
333
|
asOf: n,
|
|
324
|
-
note:
|
|
334
|
+
note: s
|
|
325
335
|
}
|
|
326
336
|
)
|
|
327
337
|
}
|
|
328
338
|
);
|
|
329
339
|
}
|
|
330
|
-
function
|
|
340
|
+
function Qt({
|
|
331
341
|
def: e,
|
|
332
342
|
row: r,
|
|
333
343
|
totalCount: n,
|
|
334
|
-
onClose:
|
|
344
|
+
onClose: s
|
|
335
345
|
}) {
|
|
336
|
-
const [l,
|
|
337
|
-
const
|
|
338
|
-
return
|
|
339
|
-
}) : "Details",
|
|
340
|
-
return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick:
|
|
346
|
+
const [l, m] = T(e.initialTab ?? 0), u = !r && n != null ? It(e, n) : e.title ? e.title.replace(/\{\{\s*([\w.]+)\s*\}\}/g, (c, x) => {
|
|
347
|
+
const N = r == null ? void 0 : r[x];
|
|
348
|
+
return N == null ? "" : String(N);
|
|
349
|
+
}) : "Details", d = typeof e.width == "number" ? `${e.width}px` : e.width ?? "90%", o = e.resolvedTabs[l];
|
|
350
|
+
return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: s, children: /* @__PURE__ */ h(
|
|
341
351
|
"div",
|
|
342
352
|
{
|
|
343
353
|
className: "flex h-full flex-col border-l border-slate-200 bg-slate-50 shadow-2xl dark:border-border dark:bg-background",
|
|
344
|
-
style: { width:
|
|
345
|
-
onClick: (
|
|
354
|
+
style: { width: d, maxWidth: "96%" },
|
|
355
|
+
onClick: (c) => c.stopPropagation(),
|
|
346
356
|
children: [
|
|
347
|
-
/* @__PURE__ */
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children:
|
|
350
|
-
e.resolvedTabs.length > 1 && /* @__PURE__ */ t("div", { className: "flex gap-1", children: e.resolvedTabs.map((
|
|
357
|
+
/* @__PURE__ */ h("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 bg-white px-4 py-2.5 dark:border-border dark:bg-card", children: [
|
|
358
|
+
/* @__PURE__ */ h("div", { className: "flex items-center gap-3", children: [
|
|
359
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: u }),
|
|
360
|
+
e.resolvedTabs.length > 1 && /* @__PURE__ */ t("div", { className: "flex gap-1", children: e.resolvedTabs.map((c, x) => /* @__PURE__ */ t(
|
|
351
361
|
"button",
|
|
352
362
|
{
|
|
353
363
|
type: "button",
|
|
354
|
-
onClick: () =>
|
|
364
|
+
onClick: () => m(x),
|
|
355
365
|
className: `rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors ${x === l ? "bg-nvr-cyan/10 text-slate-800 dark:text-slate-100" : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"}`,
|
|
356
|
-
children:
|
|
366
|
+
children: c.label
|
|
357
367
|
},
|
|
358
|
-
|
|
368
|
+
c.label
|
|
359
369
|
)) })
|
|
360
370
|
] }),
|
|
361
371
|
/* @__PURE__ */ t(
|
|
362
372
|
"button",
|
|
363
373
|
{
|
|
364
374
|
type: "button",
|
|
365
|
-
onClick:
|
|
375
|
+
onClick: s,
|
|
366
376
|
className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
367
377
|
children: "Close"
|
|
368
378
|
}
|
|
369
379
|
)
|
|
370
380
|
] }),
|
|
371
381
|
e.header && /* @__PURE__ */ t(
|
|
372
|
-
|
|
382
|
+
Kt,
|
|
373
383
|
{
|
|
374
384
|
config: e.header.config,
|
|
375
385
|
stats: e.header.stats,
|
|
@@ -377,148 +387,148 @@ function At({
|
|
|
377
387
|
note: e.header.note
|
|
378
388
|
}
|
|
379
389
|
),
|
|
380
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children:
|
|
381
|
-
|
|
390
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: o != null && o.matrix ? /* @__PURE__ */ t(
|
|
391
|
+
fe,
|
|
382
392
|
{
|
|
383
|
-
config:
|
|
384
|
-
initialScope:
|
|
393
|
+
config: o.matrix.config,
|
|
394
|
+
initialScope: o.matrix.initialScope,
|
|
385
395
|
lockScope: !0
|
|
386
396
|
},
|
|
387
397
|
l
|
|
388
|
-
) :
|
|
389
|
-
|
|
398
|
+
) : o != null && o.config ? /* @__PURE__ */ h(H, { children: [
|
|
399
|
+
o.note && /* @__PURE__ */ t(
|
|
390
400
|
"p",
|
|
391
401
|
{
|
|
392
402
|
className: "border-b border-slate-200 bg-white px-4 py-1.5 text-[11.5px] text-slate-500 dark:border-border dark:bg-card dark:text-slate-400",
|
|
393
403
|
"data-sheet-tab-note": !0,
|
|
394
|
-
children:
|
|
404
|
+
children: o.note
|
|
395
405
|
}
|
|
396
406
|
),
|
|
397
|
-
/* @__PURE__ */ t(
|
|
407
|
+
/* @__PURE__ */ t(Ve, { config: o.config }, l)
|
|
398
408
|
] }) : /* @__PURE__ */ t("p", { className: "p-4 text-[12px] text-slate-400", children: "Sheet not configured" }) })
|
|
399
409
|
]
|
|
400
410
|
}
|
|
401
411
|
) });
|
|
402
412
|
}
|
|
403
|
-
function
|
|
413
|
+
function Ut(e, r, n, s) {
|
|
404
414
|
if (!e) return;
|
|
405
|
-
const l = (
|
|
406
|
-
const
|
|
407
|
-
if (!
|
|
408
|
-
const x =
|
|
409
|
-
if (
|
|
410
|
-
const
|
|
411
|
-
return
|
|
412
|
-
},
|
|
413
|
-
Object.entries(
|
|
414
|
-
) :
|
|
415
|
-
return Array.isArray(
|
|
415
|
+
const l = (o) => {
|
|
416
|
+
const c = /^\$filters\.(\w+)(?:\.(\w+))?$/.exec(o);
|
|
417
|
+
if (!c) return;
|
|
418
|
+
const x = s == null ? void 0 : s.find((S) => S.param === c[1]), N = (n == null ? void 0 : n[c[1]]) ?? [];
|
|
419
|
+
if (N.length === 0) return;
|
|
420
|
+
const C = c[2] ?? (x == null ? void 0 : x.value_field) ?? "id";
|
|
421
|
+
return N.map((S) => S[C]);
|
|
422
|
+
}, m = (o) => typeof o == "string" && o.startsWith("$row.") ? r[o.slice(5)] : typeof o == "string" && o.startsWith("$filters.") ? l(o) : Array.isArray(o) ? o.map(m) : o && typeof o == "object" ? Object.fromEntries(
|
|
423
|
+
Object.entries(o).map(([c, x]) => [c, m(x)])
|
|
424
|
+
) : o, u = (o) => o === void 0 ? !0 : Array.isArray(o) ? o.some(u) : o && typeof o == "object" ? Object.values(o).some(u) : !1, d = m(e);
|
|
425
|
+
return Array.isArray(d._and) && (d._and = d._and.filter((o) => !u(o))), u(d) ? void 0 : d;
|
|
416
426
|
}
|
|
417
|
-
const
|
|
418
|
-
function
|
|
427
|
+
const Vt = 400, Gt = 2500;
|
|
428
|
+
function Ee(e, r) {
|
|
419
429
|
return e.map((n) => String(n[r] ?? "")).sort().join("\0");
|
|
420
430
|
}
|
|
421
|
-
function
|
|
431
|
+
function Jt({
|
|
422
432
|
filter: e,
|
|
423
433
|
selected: r,
|
|
424
434
|
onChange: n,
|
|
425
|
-
allowedIds:
|
|
435
|
+
allowedIds: s,
|
|
426
436
|
scopeDefault: l,
|
|
427
|
-
onOpenChange:
|
|
437
|
+
onOpenChange: m
|
|
428
438
|
}) {
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
var
|
|
432
|
-
(
|
|
433
|
-
}, [
|
|
434
|
-
const [x,
|
|
439
|
+
const u = re(), [d, o] = T(!1), c = ee(m);
|
|
440
|
+
c.current = m, te(() => {
|
|
441
|
+
var f;
|
|
442
|
+
(f = c.current) == null || f.call(c, d);
|
|
443
|
+
}, [d]);
|
|
444
|
+
const [x, N] = T(""), C = ee(null), S = e.value_field ?? "id", q = e.label_field ?? S, v = e.secondary_field, j = [.../* @__PURE__ */ new Set(["id", S, q, v ?? ""])].filter(Boolean).join(","), { data: W } = Y({
|
|
435
445
|
queryKey: [
|
|
436
446
|
"page-renderer-filter",
|
|
437
447
|
e.collection,
|
|
438
|
-
|
|
448
|
+
S,
|
|
439
449
|
q,
|
|
440
|
-
|
|
450
|
+
v ?? "",
|
|
441
451
|
e.sort
|
|
442
452
|
],
|
|
443
|
-
queryFn: () =>
|
|
444
|
-
|
|
445
|
-
fields:
|
|
453
|
+
queryFn: () => u.request(
|
|
454
|
+
xe(`/items/${e.collection}`, {
|
|
455
|
+
fields: j,
|
|
446
456
|
limit: e.limit ?? 500,
|
|
447
457
|
...e.sort ? { sort: e.sort } : {}
|
|
448
458
|
})
|
|
449
|
-
).then((
|
|
450
|
-
const
|
|
451
|
-
return { rows:
|
|
459
|
+
).then((f) => {
|
|
460
|
+
const a = f.data ?? [], g = typeof f.total == "number" && f.total > a.length || a.length >= (e.limit ?? 500);
|
|
461
|
+
return { rows: a, more: g };
|
|
452
462
|
}),
|
|
453
463
|
staleTime: 6e4
|
|
454
|
-
}),
|
|
455
|
-
queryKey: ["page-renderer-filter-search", e.collection,
|
|
456
|
-
enabled:
|
|
457
|
-
queryFn: () =>
|
|
458
|
-
|
|
459
|
-
fields:
|
|
464
|
+
}), U = (W == null ? void 0 : W.rows) ?? [], L = (W == null ? void 0 : W.more) === !0, $ = x.trim(), R = at($), { data: I = [] } = Y({
|
|
465
|
+
queryKey: ["page-renderer-filter-search", e.collection, j, R],
|
|
466
|
+
enabled: L && R.length > 0,
|
|
467
|
+
queryFn: () => u.request(
|
|
468
|
+
xe(`/items/${e.collection}`, {
|
|
469
|
+
fields: j,
|
|
460
470
|
limit: 100,
|
|
461
|
-
search:
|
|
462
|
-
search_fields: [.../* @__PURE__ */ new Set([
|
|
471
|
+
search: R,
|
|
472
|
+
search_fields: [.../* @__PURE__ */ new Set([S, q, v ?? ""])].filter(Boolean).join(","),
|
|
463
473
|
...e.sort ? { sort: e.sort } : {}
|
|
464
474
|
})
|
|
465
|
-
).then((
|
|
475
|
+
).then((f) => f.data ?? []),
|
|
466
476
|
staleTime: 6e4
|
|
467
477
|
});
|
|
468
|
-
|
|
469
|
-
if (!
|
|
470
|
-
const
|
|
471
|
-
|
|
478
|
+
te(() => {
|
|
479
|
+
if (!d) return;
|
|
480
|
+
const f = (a) => {
|
|
481
|
+
C.current && !C.current.contains(a.target) && o(!1);
|
|
472
482
|
};
|
|
473
|
-
return window.addEventListener("mousedown",
|
|
474
|
-
}, [
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
(
|
|
478
|
-
),
|
|
479
|
-
(
|
|
480
|
-
),
|
|
483
|
+
return window.addEventListener("mousedown", f), () => window.removeEventListener("mousedown", f);
|
|
484
|
+
}, [d]);
|
|
485
|
+
const K = e.label ?? Q(e.param), z = L && $ ? [...r, ...I] : U, E = vt(
|
|
486
|
+
s != null && s.length ? z.filter((f) => s.some((a) => String(a) === String(f.id))) : z,
|
|
487
|
+
(f) => String(f[S] ?? "")
|
|
488
|
+
), O = (f) => [f[S], f[q], v ? f[v] : null].filter((a) => a != null && a !== "").join(" ").toLowerCase(), V = E.filter(
|
|
489
|
+
(f) => $ ? O(f).includes($.toLowerCase()) : !0
|
|
490
|
+
), G = L && $.length > 0 && R !== $, B = s != null && s.length ? {
|
|
481
491
|
label: "restricted",
|
|
482
492
|
cls: "bg-amber-500/15 text-amber-700 dark:text-amber-300",
|
|
483
|
-
title: `Options limited to your restricted ${
|
|
493
|
+
title: `Options limited to your restricted ${K} scope${l ? "; selection seeded from your defaults" : ""}`
|
|
484
494
|
} : l && r.length > 0 ? {
|
|
485
495
|
label: "your default",
|
|
486
496
|
cls: "bg-nvr-cyan/[0.12] text-[#0284a8] dark:text-nvr-cyan",
|
|
487
|
-
title: `Pre-selected from your default ${
|
|
497
|
+
title: `Pre-selected from your default ${K} scope — adjust freely`
|
|
488
498
|
} : null;
|
|
489
|
-
return /* @__PURE__ */
|
|
490
|
-
/* @__PURE__ */
|
|
499
|
+
return /* @__PURE__ */ h("div", { ref: C, className: "relative", children: [
|
|
500
|
+
/* @__PURE__ */ h(
|
|
491
501
|
"button",
|
|
492
502
|
{
|
|
493
503
|
type: "button",
|
|
494
|
-
onClick: () =>
|
|
504
|
+
onClick: () => o((f) => !f),
|
|
495
505
|
className: `inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] transition-colors ${r.length > 0 ? "border-nvr-cyan bg-nvr-cyan/10 text-slate-700 dark:text-slate-200" : "border-slate-200 bg-white text-slate-600 hover:border-slate-400 dark:border-border dark:bg-card dark:text-slate-300"}`,
|
|
496
506
|
children: [
|
|
497
|
-
/* @__PURE__ */ t("span", { className: "font-medium", children:
|
|
498
|
-
|
|
507
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: K }),
|
|
508
|
+
B && /* @__PURE__ */ t(
|
|
499
509
|
"span",
|
|
500
510
|
{
|
|
501
|
-
title:
|
|
502
|
-
className: `rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide ${
|
|
503
|
-
children:
|
|
511
|
+
title: B.title,
|
|
512
|
+
className: `rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide ${B.cls}`,
|
|
513
|
+
children: B.label
|
|
504
514
|
}
|
|
505
515
|
),
|
|
506
|
-
/* @__PURE__ */ t("span", { className: "text-slate-400", children: r.length === 0 ? "All" : r.length === 1 ? String(r[0][q] ?? r[0][
|
|
516
|
+
/* @__PURE__ */ t("span", { className: "text-slate-400", children: r.length === 0 ? "All" : r.length === 1 ? String(r[0][q] ?? r[0][S] ?? "") : `${r.length} selected` }),
|
|
507
517
|
/* @__PURE__ */ t("span", { className: "text-slate-400", children: "⌃" })
|
|
508
518
|
]
|
|
509
519
|
}
|
|
510
520
|
),
|
|
511
|
-
|
|
521
|
+
d && /* @__PURE__ */ h("div", { className: "absolute left-0 top-9 z-40 w-56 rounded-md border border-slate-200 bg-white p-1 shadow-md dark:border-border dark:bg-popover", children: [
|
|
512
522
|
/* @__PURE__ */ t(
|
|
513
523
|
"input",
|
|
514
524
|
{
|
|
515
525
|
value: x,
|
|
516
|
-
onChange: (
|
|
526
|
+
onChange: (f) => N(f.target.value),
|
|
517
527
|
placeholder: "Search…",
|
|
518
528
|
className: "mb-1 h-7 w-full rounded border border-slate-200 bg-white px-2 text-[12px] outline-none dark:border-border dark:bg-background"
|
|
519
529
|
}
|
|
520
530
|
),
|
|
521
|
-
/* @__PURE__ */
|
|
531
|
+
/* @__PURE__ */ h("div", { className: "max-h-64 overflow-y-auto", children: [
|
|
522
532
|
r.length > 0 && /* @__PURE__ */ t(
|
|
523
533
|
"button",
|
|
524
534
|
{
|
|
@@ -528,52 +538,52 @@ function Dt({
|
|
|
528
538
|
children: "Clear selection"
|
|
529
539
|
}
|
|
530
540
|
),
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
return /* @__PURE__ */
|
|
541
|
+
V.map((f) => {
|
|
542
|
+
const a = String(f[S] ?? ""), g = r.some((P) => String(P[S] ?? "") === a);
|
|
543
|
+
return /* @__PURE__ */ h(
|
|
534
544
|
"button",
|
|
535
545
|
{
|
|
536
546
|
type: "button",
|
|
537
547
|
onClick: () => {
|
|
538
548
|
if (e.single) {
|
|
539
|
-
n(
|
|
549
|
+
n(g ? [] : [f]), o(!1);
|
|
540
550
|
return;
|
|
541
551
|
}
|
|
542
552
|
n(
|
|
543
|
-
|
|
553
|
+
g ? r.filter((P) => String(P[S] ?? "") !== a) : [...r, f]
|
|
544
554
|
);
|
|
545
555
|
},
|
|
546
556
|
className: "flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[12px] text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-muted",
|
|
547
557
|
children: [
|
|
548
|
-
/* @__PURE__ */ t("span", { className: `w-3.5 shrink-0 text-nvr-cyan ${
|
|
549
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: String(
|
|
550
|
-
|
|
558
|
+
/* @__PURE__ */ t("span", { className: `w-3.5 shrink-0 text-nvr-cyan ${g ? "" : "invisible"}`, children: "✓" }),
|
|
559
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: String(f[q] ?? a) }),
|
|
560
|
+
v && f[v] != null && f[v] !== "" && /* @__PURE__ */ t("span", { className: "min-w-0 truncate text-[11px] text-slate-400", children: String(f[v]) })
|
|
551
561
|
]
|
|
552
562
|
},
|
|
553
|
-
|
|
563
|
+
a
|
|
554
564
|
);
|
|
555
565
|
}),
|
|
556
|
-
|
|
557
|
-
|
|
566
|
+
V.length === 0 && /* @__PURE__ */ t("p", { className: "px-2 py-1.5 text-[12px] text-slate-400", "aria-live": "polite", children: G ? "Searching…" : $ ? `No matches for “${$}”` : "No options" }),
|
|
567
|
+
L && !$ && /* @__PURE__ */ h("p", { className: "px-2 py-1.5 text-[11px] text-slate-400", children: [
|
|
558
568
|
"Showing the first ",
|
|
559
|
-
|
|
569
|
+
U.length.toLocaleString("en-US"),
|
|
560
570
|
" — type to search all"
|
|
561
571
|
] })
|
|
562
572
|
] })
|
|
563
573
|
] })
|
|
564
574
|
] });
|
|
565
575
|
}
|
|
566
|
-
function
|
|
567
|
-
return /* @__PURE__ */ t(
|
|
576
|
+
function Ht({ widget: e }) {
|
|
577
|
+
return /* @__PURE__ */ t(Ve, { config: e.config ?? {} });
|
|
568
578
|
}
|
|
569
|
-
function
|
|
570
|
-
const r = e.config ?? {}, [n,
|
|
571
|
-
return r.collection ? r.display === "drawer" ? /* @__PURE__ */
|
|
579
|
+
function Yt({ widget: e }) {
|
|
580
|
+
const r = e.config ?? {}, [n, s] = T(!1);
|
|
581
|
+
return r.collection ? r.display === "drawer" ? /* @__PURE__ */ h("div", { className: "flex h-full items-center", children: [
|
|
572
582
|
/* @__PURE__ */ t(
|
|
573
583
|
"button",
|
|
574
584
|
{
|
|
575
585
|
type: "button",
|
|
576
|
-
onClick: () =>
|
|
586
|
+
onClick: () => s(!0),
|
|
577
587
|
className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-md border border-slate-200 bg-white px-3 text-[12.5px] font-medium text-slate-700 shadow-sm transition-colors hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:bg-card dark:text-slate-200 dark:hover:text-nvr-cyan",
|
|
578
588
|
children: r.button_label ?? r.title ?? "Manage"
|
|
579
589
|
}
|
|
@@ -582,8 +592,8 @@ function zt({ widget: e }) {
|
|
|
582
592
|
"div",
|
|
583
593
|
{
|
|
584
594
|
className: "fixed inset-0 z-50 flex justify-end bg-black/30",
|
|
585
|
-
onClick: () =>
|
|
586
|
-
children: /* @__PURE__ */
|
|
595
|
+
onClick: () => s(!1),
|
|
596
|
+
children: /* @__PURE__ */ h(
|
|
587
597
|
"div",
|
|
588
598
|
{
|
|
589
599
|
className: "flex h-full flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-border dark:bg-background",
|
|
@@ -593,31 +603,31 @@ function zt({ widget: e }) {
|
|
|
593
603
|
},
|
|
594
604
|
onClick: (l) => l.stopPropagation(),
|
|
595
605
|
children: [
|
|
596
|
-
/* @__PURE__ */
|
|
606
|
+
/* @__PURE__ */ h("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
597
607
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: r.button_label ?? r.title ?? "Manage" }),
|
|
598
608
|
/* @__PURE__ */ t(
|
|
599
609
|
"button",
|
|
600
610
|
{
|
|
601
611
|
type: "button",
|
|
602
|
-
onClick: () =>
|
|
612
|
+
onClick: () => s(!1),
|
|
603
613
|
className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
604
614
|
children: "Close"
|
|
605
615
|
}
|
|
606
616
|
)
|
|
607
617
|
] }),
|
|
608
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(
|
|
618
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(Ae, { config: r }) })
|
|
609
619
|
]
|
|
610
620
|
}
|
|
611
621
|
)
|
|
612
622
|
}
|
|
613
623
|
)
|
|
614
|
-
] }) : /* @__PURE__ */ t(
|
|
624
|
+
] }) : /* @__PURE__ */ t(Ae, { config: r }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Configure the record grid (collection)" });
|
|
615
625
|
}
|
|
616
|
-
function
|
|
626
|
+
function Xt({
|
|
617
627
|
cfg: e
|
|
618
628
|
}) {
|
|
619
|
-
const [r, n] =
|
|
620
|
-
return delete
|
|
629
|
+
const [r, n] = T(!1), s = { ...e };
|
|
630
|
+
return delete s.display, /* @__PURE__ */ h("div", { className: "flex h-full items-center", children: [
|
|
621
631
|
/* @__PURE__ */ t(
|
|
622
632
|
"button",
|
|
623
633
|
{
|
|
@@ -632,7 +642,7 @@ function Kt({
|
|
|
632
642
|
{
|
|
633
643
|
className: "fixed inset-0 z-50 flex justify-end bg-black/30",
|
|
634
644
|
onClick: () => n(!1),
|
|
635
|
-
children: /* @__PURE__ */
|
|
645
|
+
children: /* @__PURE__ */ h(
|
|
636
646
|
"div",
|
|
637
647
|
{
|
|
638
648
|
className: "flex h-full flex-col border-l border-slate-200 bg-slate-50 shadow-2xl dark:border-border dark:bg-background",
|
|
@@ -642,7 +652,7 @@ function Kt({
|
|
|
642
652
|
},
|
|
643
653
|
onClick: (l) => l.stopPropagation(),
|
|
644
654
|
children: [
|
|
645
|
-
/* @__PURE__ */
|
|
655
|
+
/* @__PURE__ */ h("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 bg-white px-4 py-2.5 dark:border-border dark:bg-card", children: [
|
|
646
656
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: e.button_label ?? e.label ?? "View" }),
|
|
647
657
|
/* @__PURE__ */ t(
|
|
648
658
|
"button",
|
|
@@ -654,7 +664,7 @@ function Kt({
|
|
|
654
664
|
}
|
|
655
665
|
)
|
|
656
666
|
] }),
|
|
657
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(
|
|
667
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(Ge, { config: s }) })
|
|
658
668
|
]
|
|
659
669
|
}
|
|
660
670
|
)
|
|
@@ -662,194 +672,196 @@ function Kt({
|
|
|
662
672
|
)
|
|
663
673
|
] });
|
|
664
674
|
}
|
|
665
|
-
function
|
|
666
|
-
return e.display === "drawer" ? /* @__PURE__ */ t(
|
|
675
|
+
function Ve({ config: e }) {
|
|
676
|
+
return e.display === "drawer" ? /* @__PURE__ */ t(Xt, { cfg: e }) : /* @__PURE__ */ t(Ge, { config: e });
|
|
667
677
|
}
|
|
668
|
-
function
|
|
669
|
-
var
|
|
670
|
-
const r =
|
|
671
|
-
() =>
|
|
672
|
-
), [
|
|
673
|
-
() =>
|
|
674
|
-
),
|
|
675
|
-
const
|
|
676
|
-
if (x(
|
|
677
|
-
const
|
|
678
|
-
|
|
678
|
+
function Ge({ config: e }) {
|
|
679
|
+
var _e, Ce, qe, je, Te, Me, Re, We, Pe, Le;
|
|
680
|
+
const r = re(), n = Ie(), [s, l] = T(null), [m, u] = T(null), [d, o] = T(null), [c, x] = T(
|
|
681
|
+
() => Bt(e.filters)
|
|
682
|
+
), [N] = T(
|
|
683
|
+
() => xt(e.filters, typeof window > "u" ? "" : window.location.search)
|
|
684
|
+
), C = (i, p) => {
|
|
685
|
+
const b = { ...c, [i]: p };
|
|
686
|
+
if (x(b), typeof window > "u" || !(e.filters ?? []).some((k) => k.url_param)) return;
|
|
687
|
+
const y = bt(e.filters, b, window.location.search);
|
|
688
|
+
y !== window.location.search && window.history.replaceState(
|
|
679
689
|
window.history.state,
|
|
680
690
|
"",
|
|
681
|
-
`${window.location.pathname}${
|
|
691
|
+
`${window.location.pathname}${y}${window.location.hash}`
|
|
682
692
|
);
|
|
683
|
-
}, [
|
|
684
|
-
|
|
685
|
-
if ((
|
|
693
|
+
}, [S, q] = T(null), [v, j] = T(null), W = (v == null ? void 0 : v.phase) === "running", U = De(), L = be();
|
|
694
|
+
te(() => {
|
|
695
|
+
if ((v == null ? void 0 : v.phase) !== "running") return;
|
|
686
696
|
const i = window.setInterval(() => {
|
|
687
|
-
|
|
688
|
-
(
|
|
697
|
+
j(
|
|
698
|
+
(p) => (p == null ? void 0 : p.phase) === "running" ? { ...p, elapsedMs: Date.now() - p.startedAt } : p
|
|
689
699
|
);
|
|
690
700
|
}, 250);
|
|
691
701
|
return () => window.clearInterval(i);
|
|
692
|
-
}, [
|
|
693
|
-
const { scopes:
|
|
694
|
-
|
|
695
|
-
if (
|
|
696
|
-
|
|
702
|
+
}, [v == null ? void 0 : v.phase]);
|
|
703
|
+
const { scopes: $, ready: R } = kt(), I = ee(!1), [K, z] = T(!1), [E, O] = T(/* @__PURE__ */ new Map());
|
|
704
|
+
te(() => {
|
|
705
|
+
if (I.current || !R) return;
|
|
706
|
+
I.current = !0;
|
|
697
707
|
const i = (e.filters ?? []).filter(
|
|
698
|
-
(
|
|
708
|
+
(p) => !(c[p.param] ?? []).length && !N.has(p.param)
|
|
699
709
|
);
|
|
700
|
-
if (
|
|
701
|
-
|
|
710
|
+
if (!$ || !i.length) {
|
|
711
|
+
z(!0);
|
|
702
712
|
return;
|
|
703
713
|
}
|
|
704
714
|
(async () => {
|
|
705
715
|
try {
|
|
706
|
-
const
|
|
707
|
-
for (const
|
|
708
|
-
const
|
|
709
|
-
if (!
|
|
710
|
-
const
|
|
711
|
-
if (!
|
|
712
|
-
const
|
|
716
|
+
const p = {};
|
|
717
|
+
for (const b of i) {
|
|
718
|
+
const y = Oe($, { key: b.param, collection: b.collection });
|
|
719
|
+
if (!y) continue;
|
|
720
|
+
const k = wt($, y.name);
|
|
721
|
+
if (!k.length) continue;
|
|
722
|
+
const _ = b.value_field ?? "id", F = await Nt(
|
|
713
723
|
r,
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
724
|
+
y,
|
|
725
|
+
k,
|
|
726
|
+
_
|
|
717
727
|
);
|
|
718
|
-
if (
|
|
719
|
-
const
|
|
720
|
-
|
|
728
|
+
if (F.length) {
|
|
729
|
+
const M = F.map((ae, ce) => ({ [_]: ae, id: k[ce] }));
|
|
730
|
+
p[b.param] = b.single ? M.slice(0, 1) : M;
|
|
721
731
|
}
|
|
722
732
|
}
|
|
723
|
-
Object.keys(
|
|
724
|
-
const
|
|
725
|
-
for (const [
|
|
726
|
-
(
|
|
727
|
-
return
|
|
728
|
-
}),
|
|
733
|
+
Object.keys(p).length && (x((b) => {
|
|
734
|
+
const y = { ...b };
|
|
735
|
+
for (const [k, _] of Object.entries(p))
|
|
736
|
+
(y[k] ?? []).length || (y[k] = _);
|
|
737
|
+
return y;
|
|
738
|
+
}), O(
|
|
729
739
|
new Map(
|
|
730
|
-
Object.entries(
|
|
731
|
-
var
|
|
732
|
-
const
|
|
733
|
-
return [
|
|
740
|
+
Object.entries(p).map(([b, y]) => {
|
|
741
|
+
var _;
|
|
742
|
+
const k = ((_ = (e.filters ?? []).find((F) => F.param === b)) == null ? void 0 : _.value_field) ?? "id";
|
|
743
|
+
return [b, Ee(y, k)];
|
|
734
744
|
})
|
|
735
745
|
)
|
|
736
746
|
));
|
|
737
747
|
} finally {
|
|
738
|
-
|
|
748
|
+
z(!0);
|
|
739
749
|
}
|
|
740
750
|
})();
|
|
741
|
-
}, [R,
|
|
742
|
-
const
|
|
751
|
+
}, [R, $, e.filters, c, r, N]);
|
|
752
|
+
const V = he(() => {
|
|
743
753
|
const i = { ...e.params ?? {} };
|
|
744
|
-
for (const
|
|
745
|
-
const
|
|
746
|
-
|
|
754
|
+
for (const p of e.filters ?? []) {
|
|
755
|
+
const b = c[p.param] ?? [];
|
|
756
|
+
b.length > 0 && (i[p.param] = b.map((y) => String(y[p.value_field ?? "id"] ?? "")).join(","));
|
|
747
757
|
}
|
|
748
758
|
return i;
|
|
749
|
-
}, [e.params, e.filters,
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
),
|
|
753
|
-
() => JSON.parse(
|
|
754
|
-
[
|
|
755
|
-
),
|
|
756
|
-
data:
|
|
757
|
-
isPending:
|
|
758
|
-
error:
|
|
759
|
-
refetch:
|
|
760
|
-
isFetching:
|
|
761
|
-
isPlaceholderData:
|
|
762
|
-
} =
|
|
763
|
-
queryKey: ["page-renderer-query", e.query_slug,
|
|
759
|
+
}, [e.params, e.filters, c]), [G, B] = T(/* @__PURE__ */ new Set()), f = ee(!1), a = JSON.stringify(V), g = ct(
|
|
760
|
+
a,
|
|
761
|
+
f.current ? G.size > 0 ? Gt : Vt : 0
|
|
762
|
+
), P = f.current ? g : a, D = he(
|
|
763
|
+
() => JSON.parse(P),
|
|
764
|
+
[P]
|
|
765
|
+
), J = ee(!1), {
|
|
766
|
+
data: A,
|
|
767
|
+
isPending: X,
|
|
768
|
+
error: ye,
|
|
769
|
+
refetch: ve,
|
|
770
|
+
isFetching: ke,
|
|
771
|
+
isPlaceholderData: Je
|
|
772
|
+
} = Y({
|
|
773
|
+
queryKey: ["page-renderer-query", e.query_slug, P],
|
|
764
774
|
queryFn: () => {
|
|
765
|
-
const i =
|
|
766
|
-
return
|
|
767
|
-
|
|
768
|
-
params:
|
|
775
|
+
const i = J.current;
|
|
776
|
+
return J.current = !1, r.request(
|
|
777
|
+
le(`/custom-queries/${e.query_slug}/execute`, {
|
|
778
|
+
params: D,
|
|
769
779
|
...i ? { refresh: !0 } : {}
|
|
770
780
|
})
|
|
771
781
|
);
|
|
772
782
|
},
|
|
773
|
-
enabled: !!e.query_slug &&
|
|
783
|
+
enabled: !!e.query_slug && K,
|
|
774
784
|
staleTime: 6e4,
|
|
785
|
+
meta: L,
|
|
775
786
|
// A filter change (FY, zone) keeps the table on screen, dimmed, until the
|
|
776
787
|
// new answer lands: swapping it for the loader unmounted QueryTable and
|
|
777
788
|
// reset its view state — "Hide empty rows" switched itself off (L13).
|
|
778
789
|
// Only the same query's answer stands in; another slug starts fresh.
|
|
779
|
-
placeholderData: (i,
|
|
780
|
-
}),
|
|
781
|
-
|
|
782
|
-
}, [
|
|
790
|
+
placeholderData: (i, p) => (p == null ? void 0 : p.queryKey[1]) === e.query_slug ? i : void 0
|
|
791
|
+
}), Z = A == null ? void 0 : A.data, ne = Je && ke, He = rt(() => {
|
|
792
|
+
J.current = !0, ve();
|
|
793
|
+
}, [ve]), we = X;
|
|
783
794
|
if (!e.query_slug) return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Set a query slug" });
|
|
784
|
-
const
|
|
785
|
-
var
|
|
786
|
-
const
|
|
787
|
-
for (const [
|
|
788
|
-
const
|
|
789
|
-
if (
|
|
790
|
-
q(`Select a value for "${
|
|
795
|
+
const Ye = (i) => {
|
|
796
|
+
var k;
|
|
797
|
+
const p = {};
|
|
798
|
+
for (const [_, F] of Object.entries(i.params ?? {})) {
|
|
799
|
+
const M = Ue(F, null, Z ?? [], D, c, e.filters);
|
|
800
|
+
if (M === void 0) {
|
|
801
|
+
q(`Select a value for "${_}" first`);
|
|
791
802
|
return;
|
|
792
803
|
}
|
|
793
|
-
|
|
804
|
+
p[_] = M;
|
|
794
805
|
}
|
|
795
|
-
const
|
|
806
|
+
const b = (k = i.confirm) == null ? void 0 : k.replace(/\{(\w+)\}/g, (_, F) => String(p[F] ?? "")), y = {
|
|
796
807
|
action: i,
|
|
797
|
-
params:
|
|
798
|
-
phase:
|
|
799
|
-
confirmText:
|
|
808
|
+
params: p,
|
|
809
|
+
phase: b ? "confirm" : "running",
|
|
810
|
+
confirmText: b ?? null,
|
|
800
811
|
startedAt: Date.now(),
|
|
801
812
|
elapsedMs: 0
|
|
802
813
|
};
|
|
803
|
-
|
|
804
|
-
},
|
|
805
|
-
const
|
|
806
|
-
|
|
814
|
+
j(y), b || Ne(y);
|
|
815
|
+
}, Ne = async (i) => {
|
|
816
|
+
const p = Date.now();
|
|
817
|
+
j({ ...i, phase: "running", startedAt: p, elapsedMs: 0 });
|
|
807
818
|
try {
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
),
|
|
811
|
-
|
|
812
|
-
(
|
|
813
|
-
...
|
|
819
|
+
const b = await r.request(
|
|
820
|
+
le(`/custom-queries/${i.action.query_slug}/execute`, { params: i.params })
|
|
821
|
+
), y = Array.isArray(b == null ? void 0 : b.data) ? b.data : [];
|
|
822
|
+
j(
|
|
823
|
+
(k) => k && k.action === i.action ? {
|
|
824
|
+
...k,
|
|
814
825
|
phase: "done",
|
|
815
|
-
elapsedMs: Date.now() -
|
|
816
|
-
resultRows:
|
|
817
|
-
resultSample:
|
|
818
|
-
} :
|
|
826
|
+
elapsedMs: Date.now() - p,
|
|
827
|
+
resultRows: y.length,
|
|
828
|
+
resultSample: y[0] ?? null
|
|
829
|
+
} : k
|
|
819
830
|
), q(
|
|
820
|
-
`${i.action.success_message ?? `${i.action.label} completed`} · ${
|
|
821
|
-
),
|
|
822
|
-
} catch (
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
(
|
|
826
|
-
), q(`${i.action.label} failed: ${
|
|
831
|
+
`${i.action.success_message ?? `${i.action.label} completed`} · ${se(Date.now() - p)}`
|
|
832
|
+
), U.invalidateQueries({ queryKey: ["page-renderer-query", e.query_slug] });
|
|
833
|
+
} catch (b) {
|
|
834
|
+
const y = ze(b, "unknown error");
|
|
835
|
+
j(
|
|
836
|
+
(k) => k && k.action === i.action ? { ...k, phase: "error", elapsedMs: Date.now() - p, error: y } : k
|
|
837
|
+
), q(`${i.action.label} failed: ${y}`);
|
|
827
838
|
}
|
|
828
|
-
},
|
|
829
|
-
|
|
839
|
+
}, Xe = /* @__PURE__ */ t(
|
|
840
|
+
_t,
|
|
830
841
|
{
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
842
|
+
scope: `query:${e.query_slug}`,
|
|
843
|
+
envelope: A,
|
|
844
|
+
onRefresh: He,
|
|
845
|
+
refreshing: ke && !X,
|
|
834
846
|
className: "ml-auto"
|
|
835
847
|
}
|
|
836
|
-
),
|
|
848
|
+
), de = e.filters && e.filters.length > 0 || (_e = e.actions) != null && _e.length || A != null && A.cache_ttl ? /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-2 pb-2", children: [
|
|
837
849
|
(e.filters ?? []).map((i) => {
|
|
838
|
-
const
|
|
850
|
+
const p = Oe($, { key: i.param, collection: i.collection }), b = p ? ($ == null ? void 0 : $.restricted[p.name]) ?? [] : [];
|
|
839
851
|
return /* @__PURE__ */ t(
|
|
840
|
-
|
|
852
|
+
Jt,
|
|
841
853
|
{
|
|
842
854
|
filter: i,
|
|
843
|
-
selected:
|
|
844
|
-
allowedIds:
|
|
845
|
-
scopeDefault:
|
|
846
|
-
onChange: (
|
|
847
|
-
|
|
855
|
+
selected: c[i.param] ?? [],
|
|
856
|
+
allowedIds: b.length > 0 ? b : void 0,
|
|
857
|
+
scopeDefault: E.has(i.param) && E.get(i.param) === Ee(c[i.param] ?? [], i.value_field ?? "id"),
|
|
858
|
+
onChange: (y) => {
|
|
859
|
+
f.current = !0, C(i.param, y);
|
|
848
860
|
},
|
|
849
|
-
onOpenChange: (
|
|
850
|
-
if (
|
|
851
|
-
const
|
|
852
|
-
return
|
|
861
|
+
onOpenChange: (y) => B((k) => {
|
|
862
|
+
if (k.has(i.param) === y) return k;
|
|
863
|
+
const _ = new Set(k);
|
|
864
|
+
return y ? _.add(i.param) : _.delete(i.param), _;
|
|
853
865
|
})
|
|
854
866
|
},
|
|
855
867
|
i.param
|
|
@@ -859,94 +871,94 @@ function Ke({ config: e }) {
|
|
|
859
871
|
"button",
|
|
860
872
|
{
|
|
861
873
|
type: "button",
|
|
862
|
-
disabled:
|
|
863
|
-
onClick: () => void
|
|
874
|
+
disabled: W,
|
|
875
|
+
onClick: () => void Ye(i),
|
|
864
876
|
className: "ml-auto inline-flex h-8 items-center rounded-md bg-nvr-cyan px-3 text-[12px] font-semibold text-white hover:opacity-90 disabled:opacity-50",
|
|
865
|
-
children:
|
|
877
|
+
children: W ? "Running…" : i.label
|
|
866
878
|
},
|
|
867
879
|
i.label
|
|
868
880
|
)),
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
] }) : null,
|
|
872
|
-
|
|
881
|
+
S && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: S }),
|
|
882
|
+
Xe
|
|
883
|
+
] }) : null, Se = (Ce = e.stats) != null && Ce.length ? /* @__PURE__ */ t(
|
|
884
|
+
qt,
|
|
873
885
|
{
|
|
874
886
|
stats: e.stats,
|
|
875
|
-
rows:
|
|
876
|
-
effectiveParams:
|
|
877
|
-
loading:
|
|
878
|
-
zeroDash: !!((
|
|
887
|
+
rows: Z ?? [],
|
|
888
|
+
effectiveParams: D,
|
|
889
|
+
loading: we || ne,
|
|
890
|
+
zeroDash: !!((qe = e.table) != null && qe.zero_dash)
|
|
879
891
|
}
|
|
880
892
|
) : null;
|
|
881
|
-
if (
|
|
882
|
-
return /* @__PURE__ */
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
/* @__PURE__ */ t(
|
|
893
|
+
if (we)
|
|
894
|
+
return /* @__PURE__ */ h("div", { className: "p-3", children: [
|
|
895
|
+
de,
|
|
896
|
+
Se,
|
|
897
|
+
/* @__PURE__ */ t(oe, {})
|
|
886
898
|
] });
|
|
887
|
-
if (
|
|
888
|
-
return /* @__PURE__ */
|
|
889
|
-
|
|
890
|
-
/* @__PURE__ */ t(
|
|
899
|
+
if (ye)
|
|
900
|
+
return /* @__PURE__ */ h("div", { className: "p-3", children: [
|
|
901
|
+
de,
|
|
902
|
+
/* @__PURE__ */ t(ie, { error: ye, unresolved: e.unresolved_params })
|
|
891
903
|
] });
|
|
892
|
-
const
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
904
|
+
const w = e.row_click, $e = (i, p, b) => {
|
|
905
|
+
const y = p ? null : b ?? Z ?? [], _ = yt(i, (M) => Dt(
|
|
906
|
+
M,
|
|
907
|
+
p,
|
|
908
|
+
Z ?? [],
|
|
909
|
+
D,
|
|
910
|
+
c,
|
|
899
911
|
e.filters,
|
|
900
|
-
|
|
901
|
-
)),
|
|
902
|
-
if ("matrix" in
|
|
903
|
-
const
|
|
904
|
-
for (const [
|
|
905
|
-
|
|
912
|
+
y
|
|
913
|
+
)), F = _.resolvedTabs.map((M) => {
|
|
914
|
+
if ("matrix" in M) {
|
|
915
|
+
const ae = {};
|
|
916
|
+
for (const [ce, ue] of Object.entries(M.matrix.scope))
|
|
917
|
+
ae[ce] = ue.startsWith("$row.") ? p == null ? void 0 : p[ue.slice(5)] : ue;
|
|
906
918
|
return {
|
|
907
|
-
label:
|
|
908
|
-
matrix: { config:
|
|
919
|
+
label: M.label,
|
|
920
|
+
matrix: { config: M.matrix.config, initialScope: ae }
|
|
909
921
|
};
|
|
910
922
|
}
|
|
911
|
-
return { label:
|
|
923
|
+
return { label: M.label, note: M.note, config: M.config };
|
|
912
924
|
});
|
|
913
|
-
|
|
925
|
+
o({
|
|
914
926
|
def: {
|
|
915
927
|
...i,
|
|
916
|
-
resolvedTabs:
|
|
917
|
-
header:
|
|
918
|
-
config:
|
|
919
|
-
stats:
|
|
920
|
-
asOf:
|
|
921
|
-
note:
|
|
928
|
+
resolvedTabs: F,
|
|
929
|
+
header: _.header ? {
|
|
930
|
+
config: _.header.config,
|
|
931
|
+
stats: _.header.stats,
|
|
932
|
+
asOf: _.header.asOf,
|
|
933
|
+
note: _.header.note
|
|
922
934
|
} : null,
|
|
923
|
-
initialTab:
|
|
935
|
+
initialTab: _.initialTab
|
|
924
936
|
},
|
|
925
|
-
row:
|
|
926
|
-
totalCount:
|
|
937
|
+
row: p,
|
|
938
|
+
totalCount: y ? y.length : null
|
|
927
939
|
});
|
|
928
|
-
},
|
|
929
|
-
|
|
930
|
-
collection:
|
|
940
|
+
}, Ze = w ? (i) => {
|
|
941
|
+
w.picker ? l(i) : w.sheet ? $e(w.sheet, i) : w.matrix && i.id != null ? u(i.id) : w.drill && i.id != null && (n == null || n.open({
|
|
942
|
+
collection: w.drill.collection ?? "",
|
|
931
943
|
itemId: String(i.id),
|
|
932
|
-
layoutId:
|
|
933
|
-
width:
|
|
944
|
+
layoutId: w.drill.layout_id,
|
|
945
|
+
width: w.drill.width
|
|
934
946
|
}));
|
|
935
|
-
} : void 0,
|
|
947
|
+
} : void 0, et = (je = e.row_actions) != null && je.length ? e.row_actions.map((i) => ({
|
|
936
948
|
label: i.label,
|
|
937
|
-
onClick: (
|
|
949
|
+
onClick: (p, b) => $e(i.sheet, p, b)
|
|
938
950
|
})) : void 0;
|
|
939
|
-
return /* @__PURE__ */
|
|
951
|
+
return /* @__PURE__ */ h(
|
|
940
952
|
"div",
|
|
941
953
|
{
|
|
942
|
-
className: (
|
|
954
|
+
className: (Te = e.table) != null && Te.sticky ? (
|
|
943
955
|
// Sticky grids own their scroll: filters/stats stay pinned above a
|
|
944
956
|
// scrolling table region (header/first-column/totals pin inside it).
|
|
945
957
|
"flex h-full min-h-0 flex-col overflow-hidden p-3"
|
|
946
958
|
) : "h-full overflow-auto p-3",
|
|
947
959
|
children: [
|
|
948
|
-
|
|
949
|
-
((
|
|
960
|
+
de,
|
|
961
|
+
((Me = e.note) == null ? void 0 : Me.trim()) && /* @__PURE__ */ t(
|
|
950
962
|
"p",
|
|
951
963
|
{
|
|
952
964
|
"data-query-note": !0,
|
|
@@ -954,65 +966,65 @@ function Ke({ config: e }) {
|
|
|
954
966
|
children: e.note
|
|
955
967
|
}
|
|
956
968
|
),
|
|
957
|
-
|
|
969
|
+
Se,
|
|
958
970
|
/* @__PURE__ */ t(
|
|
959
971
|
"div",
|
|
960
972
|
{
|
|
961
|
-
"data-qt-refetching":
|
|
962
|
-
"aria-busy":
|
|
963
|
-
className: `transition-opacity ${
|
|
973
|
+
"data-qt-refetching": ne ? "" : void 0,
|
|
974
|
+
"aria-busy": ne || void 0,
|
|
975
|
+
className: `transition-opacity ${ne ? "opacity-60" : ""} ${(Re = e.table) != null && Re.sticky ? "flex min-h-0 flex-1 flex-col" : ""}`.trim(),
|
|
964
976
|
children: /* @__PURE__ */ t(
|
|
965
|
-
|
|
977
|
+
jt,
|
|
966
978
|
{
|
|
967
|
-
rows:
|
|
979
|
+
rows: Z ?? [],
|
|
968
980
|
config: (
|
|
969
981
|
// Current-month highlight only applies when the selected year param
|
|
970
982
|
// IS the current year — otherwise strip it.
|
|
971
|
-
(
|
|
972
|
-
String(
|
|
983
|
+
(We = e.table) != null && We.highlight_group && e.table.highlight_year_param ? Number(
|
|
984
|
+
String(D[e.table.highlight_year_param] ?? "").split(",")[0]
|
|
973
985
|
) === (/* @__PURE__ */ new Date()).getFullYear() ? e.table : { ...e.table, highlight_group: void 0 } : e.table
|
|
974
986
|
),
|
|
975
|
-
onRowClick:
|
|
976
|
-
rowActions:
|
|
987
|
+
onRowClick: Ze,
|
|
988
|
+
rowActions: et,
|
|
977
989
|
emptyText: e.empty_label,
|
|
978
|
-
pivotYear: (
|
|
990
|
+
pivotYear: (Le = (Pe = e.table) == null ? void 0 : Pe.pivot) != null && Le.year_param && Number(String(D[e.table.pivot.year_param] ?? "").split(",")[0]) || void 0
|
|
979
991
|
}
|
|
980
992
|
)
|
|
981
993
|
}
|
|
982
994
|
),
|
|
983
|
-
(
|
|
995
|
+
(w == null ? void 0 : w.picker) && s && /* @__PURE__ */ t(
|
|
984
996
|
"div",
|
|
985
997
|
{
|
|
986
998
|
className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 pt-32",
|
|
987
999
|
onClick: () => l(null),
|
|
988
|
-
children: /* @__PURE__ */
|
|
1000
|
+
children: /* @__PURE__ */ h(
|
|
989
1001
|
"div",
|
|
990
1002
|
{
|
|
991
1003
|
className: "w-[420px] rounded-lg border border-slate-200 bg-white p-4 shadow-xl dark:border-border dark:bg-background",
|
|
992
1004
|
onClick: (i) => i.stopPropagation(),
|
|
993
1005
|
children: [
|
|
994
|
-
/* @__PURE__ */ t("p", { className: "mb-2 text-[13px] font-semibold text-slate-700 dark:text-slate-200", children:
|
|
1006
|
+
/* @__PURE__ */ t("p", { className: "mb-2 text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: w.picker.title ?? "Choose a record" }),
|
|
995
1007
|
/* @__PURE__ */ t(
|
|
996
|
-
|
|
1008
|
+
Ct,
|
|
997
1009
|
{
|
|
998
|
-
collection:
|
|
1010
|
+
collection: w.picker.collection,
|
|
999
1011
|
value: null,
|
|
1000
1012
|
onChange: (i) => {
|
|
1001
|
-
var
|
|
1013
|
+
var p, b, y, k;
|
|
1002
1014
|
if (l(null), i != null) {
|
|
1003
|
-
if (
|
|
1004
|
-
|
|
1015
|
+
if (w.matrix) {
|
|
1016
|
+
u(i);
|
|
1005
1017
|
return;
|
|
1006
1018
|
}
|
|
1007
1019
|
n == null || n.open({
|
|
1008
|
-
collection: ((
|
|
1020
|
+
collection: ((p = w.drill) == null ? void 0 : p.collection) ?? ((b = w.picker) == null ? void 0 : b.collection) ?? "",
|
|
1009
1021
|
itemId: String(i),
|
|
1010
|
-
layoutId: (
|
|
1011
|
-
width: (
|
|
1022
|
+
layoutId: (y = w.drill) == null ? void 0 : y.layout_id,
|
|
1023
|
+
width: (k = w.drill) == null ? void 0 : k.width
|
|
1012
1024
|
});
|
|
1013
1025
|
}
|
|
1014
1026
|
},
|
|
1015
|
-
extraFilter:
|
|
1027
|
+
extraFilter: Ut(w.picker.filter, s, c, e.filters),
|
|
1016
1028
|
placeholder: "Search…"
|
|
1017
1029
|
}
|
|
1018
1030
|
),
|
|
@@ -1030,32 +1042,32 @@ function Ke({ config: e }) {
|
|
|
1030
1042
|
)
|
|
1031
1043
|
}
|
|
1032
1044
|
),
|
|
1033
|
-
(
|
|
1034
|
-
|
|
1045
|
+
(w == null ? void 0 : w.matrix) && m != null && /* @__PURE__ */ t(
|
|
1046
|
+
Qe,
|
|
1035
1047
|
{
|
|
1036
|
-
config:
|
|
1037
|
-
initialScope: { [
|
|
1038
|
-
width:
|
|
1039
|
-
title:
|
|
1040
|
-
onClose: () =>
|
|
1048
|
+
config: w.matrix.config,
|
|
1049
|
+
initialScope: { [w.matrix.scope_field]: m },
|
|
1050
|
+
width: w.matrix.width,
|
|
1051
|
+
title: w.matrix.title,
|
|
1052
|
+
onClose: () => u(null)
|
|
1041
1053
|
}
|
|
1042
1054
|
),
|
|
1043
|
-
|
|
1044
|
-
|
|
1055
|
+
d && /* @__PURE__ */ t(
|
|
1056
|
+
Qt,
|
|
1045
1057
|
{
|
|
1046
|
-
def:
|
|
1047
|
-
row:
|
|
1048
|
-
totalCount:
|
|
1049
|
-
onClose: () =>
|
|
1058
|
+
def: d.def,
|
|
1059
|
+
row: d.row,
|
|
1060
|
+
totalCount: d.totalCount,
|
|
1061
|
+
onClose: () => o(null)
|
|
1050
1062
|
}
|
|
1051
1063
|
),
|
|
1052
|
-
|
|
1053
|
-
|
|
1064
|
+
v && /* @__PURE__ */ t(
|
|
1065
|
+
Zt,
|
|
1054
1066
|
{
|
|
1055
|
-
run:
|
|
1056
|
-
onConfirm: () => void
|
|
1067
|
+
run: v,
|
|
1068
|
+
onConfirm: () => void Ne(v),
|
|
1057
1069
|
onClose: () => {
|
|
1058
|
-
|
|
1070
|
+
j(null);
|
|
1059
1071
|
}
|
|
1060
1072
|
}
|
|
1061
1073
|
)
|
|
@@ -1063,15 +1075,15 @@ function Ke({ config: e }) {
|
|
|
1063
1075
|
}
|
|
1064
1076
|
);
|
|
1065
1077
|
}
|
|
1066
|
-
const
|
|
1067
|
-
function
|
|
1078
|
+
const se = (e) => e < 6e4 ? `${(e / 1e3).toFixed(e < 1e4 ? 1 : 0)}s` : `${Math.floor(e / 6e4)}m ${Math.round(e % 6e4 / 1e3)}s`;
|
|
1079
|
+
function Zt({
|
|
1068
1080
|
run: e,
|
|
1069
1081
|
onConfirm: r,
|
|
1070
1082
|
onClose: n
|
|
1071
1083
|
}) {
|
|
1072
|
-
const
|
|
1073
|
-
return
|
|
1074
|
-
/* @__PURE__ */
|
|
1084
|
+
const s = Object.entries(e.params);
|
|
1085
|
+
return st(
|
|
1086
|
+
/* @__PURE__ */ h(H, { children: [
|
|
1075
1087
|
/* @__PURE__ */ t(
|
|
1076
1088
|
"div",
|
|
1077
1089
|
{
|
|
@@ -1080,7 +1092,7 @@ function Qt({
|
|
|
1080
1092
|
onClick: e.phase === "running" ? void 0 : n
|
|
1081
1093
|
}
|
|
1082
1094
|
),
|
|
1083
|
-
/* @__PURE__ */
|
|
1095
|
+
/* @__PURE__ */ h(
|
|
1084
1096
|
"div",
|
|
1085
1097
|
{
|
|
1086
1098
|
role: "dialog",
|
|
@@ -1089,13 +1101,13 @@ function Qt({
|
|
|
1089
1101
|
className: "fixed left-1/2 top-[24vh] z-50 w-[min(400px,92vw)] -translate-x-1/2 rounded-xl border border-slate-200 bg-white p-4 shadow-2xl dark:border-border dark:bg-card",
|
|
1090
1102
|
children: [
|
|
1091
1103
|
/* @__PURE__ */ t("p", { className: "text-[13.5px] font-semibold text-slate-900 dark:text-foreground", children: e.action.label }),
|
|
1092
|
-
|
|
1093
|
-
/* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children:
|
|
1094
|
-
/* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(
|
|
1104
|
+
s.length > 0 && /* @__PURE__ */ t("dl", { className: "mt-2 space-y-0.5 rounded-lg bg-slate-50 px-2.5 py-1.5 text-[11.5px] dark:bg-muted", children: s.map(([l, m]) => /* @__PURE__ */ h("div", { className: "flex gap-2", children: [
|
|
1105
|
+
/* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: Q(l) }),
|
|
1106
|
+
/* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(m) })
|
|
1095
1107
|
] }, l)) }),
|
|
1096
|
-
e.phase === "confirm" && /* @__PURE__ */
|
|
1108
|
+
e.phase === "confirm" && /* @__PURE__ */ h(H, { children: [
|
|
1097
1109
|
/* @__PURE__ */ t("p", { className: "mt-2 text-[12.5px] text-slate-600 dark:text-slate-300", children: e.confirmText }),
|
|
1098
|
-
/* @__PURE__ */
|
|
1110
|
+
/* @__PURE__ */ h("div", { className: "mt-3 flex gap-2", children: [
|
|
1099
1111
|
/* @__PURE__ */ t(
|
|
1100
1112
|
"button",
|
|
1101
1113
|
{
|
|
@@ -1116,23 +1128,23 @@ function Qt({
|
|
|
1116
1128
|
)
|
|
1117
1129
|
] })
|
|
1118
1130
|
] }),
|
|
1119
|
-
e.phase === "running" && /* @__PURE__ */
|
|
1131
|
+
e.phase === "running" && /* @__PURE__ */ h("div", { className: "mt-3 flex items-center gap-2.5 text-[12.5px] text-slate-600 dark:text-slate-300", children: [
|
|
1120
1132
|
/* @__PURE__ */ t("span", { className: "h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-nvr-cyan border-t-transparent" }),
|
|
1121
1133
|
"Running… ",
|
|
1122
|
-
/* @__PURE__ */ t("span", { className: "tabular-nums", children:
|
|
1134
|
+
/* @__PURE__ */ t("span", { className: "tabular-nums", children: se(e.elapsedMs) })
|
|
1123
1135
|
] }),
|
|
1124
|
-
e.phase === "done" && /* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1136
|
+
e.phase === "done" && /* @__PURE__ */ h(H, { children: [
|
|
1137
|
+
/* @__PURE__ */ h("p", { className: "mt-2 text-[12.5px] font-medium text-emerald-600 dark:text-emerald-400", children: [
|
|
1126
1138
|
e.action.success_message ?? "Completed",
|
|
1127
1139
|
" · ",
|
|
1128
|
-
|
|
1140
|
+
se(e.elapsedMs)
|
|
1129
1141
|
] }),
|
|
1130
|
-
e.resultRows != null && e.resultRows > 0 && e.resultSample && /* @__PURE__ */
|
|
1131
|
-
Object.entries(e.resultSample).slice(0, 8).map(([l,
|
|
1132
|
-
/* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children:
|
|
1133
|
-
/* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(
|
|
1142
|
+
e.resultRows != null && e.resultRows > 0 && e.resultSample && /* @__PURE__ */ h("dl", { className: "mt-2 max-h-40 space-y-0.5 overflow-y-auto rounded-lg bg-slate-50 px-2.5 py-1.5 text-[11.5px] dark:bg-muted", children: [
|
|
1143
|
+
Object.entries(e.resultSample).slice(0, 8).map(([l, m]) => /* @__PURE__ */ h("div", { className: "flex gap-2", children: [
|
|
1144
|
+
/* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: Q(l) }),
|
|
1145
|
+
/* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(m ?? "—") })
|
|
1134
1146
|
] }, l)),
|
|
1135
|
-
e.resultRows > 1 && /* @__PURE__ */
|
|
1147
|
+
e.resultRows > 1 && /* @__PURE__ */ h("p", { className: "pt-0.5 text-slate-400", children: [
|
|
1136
1148
|
"…",
|
|
1137
1149
|
e.resultRows,
|
|
1138
1150
|
" result rows"
|
|
@@ -1148,14 +1160,14 @@ function Qt({
|
|
|
1148
1160
|
}
|
|
1149
1161
|
)
|
|
1150
1162
|
] }),
|
|
1151
|
-
e.phase === "error" && /* @__PURE__ */
|
|
1152
|
-
/* @__PURE__ */
|
|
1163
|
+
e.phase === "error" && /* @__PURE__ */ h(H, { children: [
|
|
1164
|
+
/* @__PURE__ */ h("p", { className: "mt-2 text-[12.5px] font-medium text-red-600 dark:text-red-400", children: [
|
|
1153
1165
|
"Failed after ",
|
|
1154
|
-
|
|
1166
|
+
se(e.elapsedMs),
|
|
1155
1167
|
": ",
|
|
1156
1168
|
e.error
|
|
1157
1169
|
] }),
|
|
1158
|
-
/* @__PURE__ */
|
|
1170
|
+
/* @__PURE__ */ h("div", { className: "mt-3 flex gap-2", children: [
|
|
1159
1171
|
/* @__PURE__ */ t(
|
|
1160
1172
|
"button",
|
|
1161
1173
|
{
|
|
@@ -1183,45 +1195,70 @@ function Qt({
|
|
|
1183
1195
|
document.body
|
|
1184
1196
|
);
|
|
1185
1197
|
}
|
|
1186
|
-
function
|
|
1198
|
+
function Be({ slug: e, widget: r }) {
|
|
1187
1199
|
var n;
|
|
1188
1200
|
switch (r.type) {
|
|
1189
1201
|
case "table":
|
|
1190
|
-
return /* @__PURE__ */ t(
|
|
1202
|
+
return /* @__PURE__ */ t(Lt, { slug: e, widget: r });
|
|
1191
1203
|
case "kpi":
|
|
1192
|
-
return /* @__PURE__ */ t(
|
|
1204
|
+
return /* @__PURE__ */ t(Ot, { slug: e, widget: r });
|
|
1193
1205
|
case "markdown":
|
|
1194
|
-
return /* @__PURE__ */ t(
|
|
1206
|
+
return /* @__PURE__ */ t(Wt, { content: String(((n = r.config) == null ? void 0 : n.content) ?? "") });
|
|
1195
1207
|
case "iframe":
|
|
1196
|
-
return /* @__PURE__ */ t(
|
|
1208
|
+
return /* @__PURE__ */ t(Ft, { widget: r });
|
|
1197
1209
|
case "query":
|
|
1198
|
-
return /* @__PURE__ */ t(
|
|
1210
|
+
return /* @__PURE__ */ t(Ht, { widget: r });
|
|
1199
1211
|
case "matrix":
|
|
1200
|
-
return /* @__PURE__ */ t(
|
|
1212
|
+
return /* @__PURE__ */ t(Et, { widget: r });
|
|
1201
1213
|
case "record-grid":
|
|
1202
|
-
return /* @__PURE__ */ t(
|
|
1214
|
+
return /* @__PURE__ */ t(Yt, { widget: r });
|
|
1203
1215
|
case "recent-activity":
|
|
1204
|
-
return /* @__PURE__ */ t(
|
|
1216
|
+
return /* @__PURE__ */ t(At, { slug: e, widget: r });
|
|
1205
1217
|
default:
|
|
1206
1218
|
return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Unknown widget" });
|
|
1207
1219
|
}
|
|
1208
1220
|
}
|
|
1209
|
-
function
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1221
|
+
function _r({
|
|
1222
|
+
slug: e,
|
|
1223
|
+
hideHeader: r,
|
|
1224
|
+
className: n,
|
|
1225
|
+
liveReads: s,
|
|
1226
|
+
liveGapMs: l
|
|
1227
|
+
}) {
|
|
1228
|
+
var B, f;
|
|
1229
|
+
const m = re(), u = De(), d = (s ?? []).filter(Boolean).join(","), o = he(
|
|
1230
|
+
() => d ? {
|
|
1231
|
+
reads: d.split(","),
|
|
1232
|
+
minGapMs: l ?? 15e3,
|
|
1233
|
+
// Server-cached figures are dropped a moment after the write (a few seconds'
|
|
1234
|
+
// window): read after that, and spread the viewers out.
|
|
1235
|
+
delayMs: 3500,
|
|
1236
|
+
jitterMs: 3e3
|
|
1237
|
+
} : null,
|
|
1238
|
+
[d, l]
|
|
1239
|
+
), [c, x] = T(0);
|
|
1240
|
+
te(() => {
|
|
1241
|
+
if (o)
|
|
1242
|
+
return u.getQueryCache().subscribe((a) => {
|
|
1243
|
+
if (a.type !== "updated" || a.action.type !== "success") return;
|
|
1244
|
+
const g = a.query;
|
|
1245
|
+
!Pt.has(String(g.queryKey[0])) || g.state.dataUpdateCount < 2 || x(Date.now());
|
|
1246
|
+
});
|
|
1247
|
+
}, [u, o]);
|
|
1248
|
+
const N = pt(c, { enabled: !!o }), { isAdmin: C } = lt(), S = Ie(), q = ot("drill.page"), v = q.value, {
|
|
1249
|
+
data: j,
|
|
1250
|
+
isLoading: W,
|
|
1251
|
+
error: U
|
|
1252
|
+
} = Y({
|
|
1216
1253
|
queryKey: ["page-renderer", e],
|
|
1217
|
-
queryFn: () =>
|
|
1254
|
+
queryFn: () => m.request(xe(`/pages/${e}`)).then((a) => a.data),
|
|
1218
1255
|
enabled: !!e,
|
|
1219
1256
|
retry: !1
|
|
1220
1257
|
});
|
|
1221
|
-
if (
|
|
1222
|
-
return /* @__PURE__ */ t("div", { className: n ?? "p-6", children: /* @__PURE__ */ t(
|
|
1223
|
-
if (
|
|
1224
|
-
return /* @__PURE__ */
|
|
1258
|
+
if (W)
|
|
1259
|
+
return /* @__PURE__ */ t("div", { className: n ?? "p-6", children: /* @__PURE__ */ t(oe, {}) });
|
|
1260
|
+
if (U || !j)
|
|
1261
|
+
return /* @__PURE__ */ h(
|
|
1225
1262
|
"div",
|
|
1226
1263
|
{
|
|
1227
1264
|
className: `flex flex-col items-center justify-center p-10 text-center ${n ?? ""}`,
|
|
@@ -1231,81 +1268,81 @@ function fr({ slug: e, hideHeader: r, className: n }) {
|
|
|
1231
1268
|
]
|
|
1232
1269
|
}
|
|
1233
1270
|
);
|
|
1234
|
-
const
|
|
1235
|
-
var
|
|
1236
|
-
return (
|
|
1237
|
-
},
|
|
1238
|
-
y:
|
|
1239
|
-
items:
|
|
1240
|
-
})),
|
|
1241
|
-
var
|
|
1242
|
-
return (
|
|
1243
|
-
}),
|
|
1244
|
-
!r && /* @__PURE__ */ t("div", { className: "shrink-0 pb-4", children: /* @__PURE__ */ t("h1", { className: "text-lg font-semibold text-slate-900 dark:text-slate-100", children:
|
|
1245
|
-
/* @__PURE__ */ t("div", { className: `min-h-0 flex-1 overflow-y-auto ${
|
|
1246
|
-
|
|
1271
|
+
const L = ((B = j.layout) == null ? void 0 : B.columns) ?? 12, $ = ht(((f = j.layout) == null ? void 0 : f.widgets) ?? [], C), R = (a) => {
|
|
1272
|
+
var g;
|
|
1273
|
+
return (a.type === "matrix" || a.type === "query" || a.type === "record-grid") && ((g = a.config) == null ? void 0 : g.display) === "drawer";
|
|
1274
|
+
}, I = [...new Set($.filter(R).map((a) => a.y))].filter((a) => $.every((g) => R(g) || a < g.y || a >= g.y + Math.max(g.h, 1))).sort((a, g) => a - g), K = I.map((a) => ({
|
|
1275
|
+
y: a,
|
|
1276
|
+
items: $.filter((g) => g.y === a && R(g)).sort((g, P) => g.x - P.x)
|
|
1277
|
+
})), z = $.filter((a) => !(R(a) && I.includes(a.y))), E = (a) => a - I.filter((g) => g < a).length, O = z.find((a) => {
|
|
1278
|
+
var g;
|
|
1279
|
+
return (g = a.config) == null ? void 0 : g.full_height;
|
|
1280
|
+
}), V = /* @__PURE__ */ h("div", { ref: N, className: `flex h-full min-h-0 flex-col ${n ?? ""}`, children: [
|
|
1281
|
+
!r && /* @__PURE__ */ t("div", { className: "shrink-0 pb-4", children: /* @__PURE__ */ t("h1", { className: "text-lg font-semibold text-slate-900 dark:text-slate-100", children: j.name }) }),
|
|
1282
|
+
/* @__PURE__ */ t("div", { className: `min-h-0 flex-1 overflow-y-auto ${O ? "flex flex-col" : ""}`, children: $.length === 0 ? /* @__PURE__ */ t("p", { className: "p-6 text-center text-[13px] text-slate-400", children: "This page has no widgets yet." }) : /* @__PURE__ */ h(H, { children: [
|
|
1283
|
+
K.map((a) => /* @__PURE__ */ t("div", { className: "mb-3 flex shrink-0 flex-wrap items-center gap-2", children: a.items.map((g) => /* @__PURE__ */ t(Be, { slug: j.slug, widget: g }, g.id)) }, a.y)),
|
|
1247
1284
|
/* @__PURE__ */ t(
|
|
1248
1285
|
"div",
|
|
1249
1286
|
{
|
|
1250
|
-
className:
|
|
1287
|
+
className: O ? "grid min-h-0 flex-1 gap-4" : "grid gap-4",
|
|
1251
1288
|
style: {
|
|
1252
|
-
gridTemplateColumns: `repeat(${
|
|
1289
|
+
gridTemplateColumns: `repeat(${L}, minmax(0, 1fr))`,
|
|
1253
1290
|
// repeat(0, …) is INVALID CSS (count must be ≥1) and drops the
|
|
1254
1291
|
// whole declaration — a fill widget in the first row band emits
|
|
1255
1292
|
// just the stretching track.
|
|
1256
|
-
...
|
|
1257
|
-
gridTemplateRows: `${
|
|
1293
|
+
...O ? {
|
|
1294
|
+
gridTemplateRows: `${E(O.y) > 0 ? `repeat(${E(O.y)}, ${me}px) ` : ""}minmax(${me * 3}px, 1fr)`
|
|
1258
1295
|
} : {},
|
|
1259
|
-
gridAutoRows: `${
|
|
1296
|
+
gridAutoRows: `${me}px`
|
|
1260
1297
|
},
|
|
1261
|
-
children:
|
|
1262
|
-
var
|
|
1263
|
-
const
|
|
1264
|
-
return /* @__PURE__ */
|
|
1298
|
+
children: z.map((a) => {
|
|
1299
|
+
var D, J, A, X;
|
|
1300
|
+
const g = (a.type === "matrix" || a.type === "query" || a.type === "record-grid") && ((D = a.config) == null ? void 0 : D.display) === "drawer", P = a === O;
|
|
1301
|
+
return /* @__PURE__ */ h(
|
|
1265
1302
|
"div",
|
|
1266
1303
|
{
|
|
1267
|
-
className:
|
|
1304
|
+
className: g ? "flex min-h-0 flex-col" : "flex min-h-0 flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm dark:border-border dark:bg-card",
|
|
1268
1305
|
style: {
|
|
1269
|
-
gridColumn: `${Math.min(
|
|
1270
|
-
gridRow:
|
|
1306
|
+
gridColumn: `${Math.min(a.x, L - 1) + 1} / span ${Math.min(a.w, L)}`,
|
|
1307
|
+
gridRow: P ? `${E(a.y) + 1} / -1` : `${E(a.y) + 1} / span ${Math.max(a.h, 1)}`
|
|
1271
1308
|
},
|
|
1272
1309
|
children: [
|
|
1273
|
-
!
|
|
1274
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ t(
|
|
1310
|
+
!g && a.type !== "kpi" && a.type !== "markdown" && ((J = a.config) == null ? void 0 : J.hide_label) !== !0 && /* @__PURE__ */ t("div", { className: "shrink-0 border-b border-slate-100 px-3 py-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:border-border", children: String(((A = a.config) == null ? void 0 : A.label) ?? "") || (typeof ((X = a.config) == null ? void 0 : X.collection) == "string" ? Q(String(a.config.collection)) : Q(a.type)) }),
|
|
1311
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ t(Be, { slug: j.slug, widget: a }) })
|
|
1275
1312
|
]
|
|
1276
1313
|
},
|
|
1277
|
-
|
|
1314
|
+
a.id
|
|
1278
1315
|
);
|
|
1279
1316
|
})
|
|
1280
1317
|
}
|
|
1281
1318
|
)
|
|
1282
1319
|
] }) })
|
|
1283
|
-
] });
|
|
1284
|
-
return
|
|
1285
|
-
|
|
1286
|
-
|
|
1320
|
+
] }), G = /* @__PURE__ */ t(Ke.Provider, { value: o, children: V });
|
|
1321
|
+
return S ? G : /* @__PURE__ */ h(it.Provider, { value: { open: (a) => q.push([a]) }, children: [
|
|
1322
|
+
v != null && v.length ? /* @__PURE__ */ t(
|
|
1323
|
+
Tt,
|
|
1287
1324
|
{
|
|
1288
|
-
collection:
|
|
1289
|
-
itemId:
|
|
1290
|
-
layoutId:
|
|
1291
|
-
width:
|
|
1292
|
-
title:
|
|
1293
|
-
stack:
|
|
1294
|
-
onPush: (
|
|
1295
|
-
onPop: () =>
|
|
1296
|
-
onClose: () =>
|
|
1325
|
+
collection: v[0].collection,
|
|
1326
|
+
itemId: v[0].itemId,
|
|
1327
|
+
layoutId: v[0].layoutId,
|
|
1328
|
+
width: v[0].width,
|
|
1329
|
+
title: v[0].title,
|
|
1330
|
+
stack: v,
|
|
1331
|
+
onPush: (a) => q.push([...v, a]),
|
|
1332
|
+
onPop: () => q.back(),
|
|
1333
|
+
onClose: () => q.back(v.length)
|
|
1297
1334
|
}
|
|
1298
1335
|
) : null,
|
|
1299
|
-
|
|
1336
|
+
G
|
|
1300
1337
|
] });
|
|
1301
1338
|
}
|
|
1302
1339
|
export {
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1340
|
+
_r as PageRenderer,
|
|
1341
|
+
Ve as QueryWidgetView,
|
|
1342
|
+
Yt as RecordGridWidgetBody,
|
|
1343
|
+
zt as missingRowParamMessage,
|
|
1344
|
+
Dt as resolveSheetConfig,
|
|
1345
|
+
Ue as resolveSheetValue,
|
|
1346
|
+
Ee as selectionSignature,
|
|
1347
|
+
It as totalSheetTitle
|
|
1311
1348
|
};
|