@nivaro/react 0.3.114 → 0.3.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ScreenShareHost.js +24 -0
- package/dist/full.css +50 -2
- package/dist/hooks/useSessionRecorder.js +61 -60
- package/dist/index.d.ts +1717 -21
- package/dist/index.js +1091 -950
- package/dist/shared/components/ActivityEntry.js +209 -97
- package/dist/shared/components/AgentPresenceChip.js +51 -0
- package/dist/shared/components/AnnouncementBanner.js +56 -41
- package/dist/shared/components/AutolinkedText.js +98 -85
- package/dist/shared/components/BroadcastView.js +149 -141
- package/dist/shared/components/CacheStamp.js +78 -30
- package/dist/shared/components/CollectionBrowserView.js +4088 -3592
- package/dist/shared/components/ConfigChangeStrip.js +63 -0
- package/dist/shared/components/ConfigReachNote.js +107 -0
- package/dist/shared/components/ConformanceView.js +389 -319
- package/dist/shared/components/DataTable.js +1 -0
- package/dist/shared/components/DelegateCoverLine.js +164 -0
- package/dist/shared/components/EnvironmentNotice.js +56 -65
- package/dist/shared/components/FilePreviewLightbox.js +89 -43
- package/dist/shared/components/FindingFixedMark.js +23 -0
- package/dist/shared/components/GridPresenceLine.js +100 -0
- package/dist/shared/components/IdleReloadWatcher.js +82 -43
- package/dist/shared/components/InStep.js +46 -0
- package/dist/shared/components/ItemEditForm.js +5504 -4889
- package/dist/shared/components/LiveAnnouncer.js +62 -0
- package/dist/shared/components/LiveCount.js +54 -0
- package/dist/shared/components/LiveFigure.js +28 -0
- package/dist/shared/components/LiveListControls.js +114 -0
- package/dist/shared/components/LiveNewMatchesPill.js +25 -0
- package/dist/shared/components/LiveOffNote.js +44 -0
- package/dist/shared/components/LivePreferenceHost.js +42 -0
- package/dist/shared/components/LiveRowMark.js +25 -20
- package/dist/shared/components/LiveTraceView.js +257 -0
- package/dist/shared/components/MapView.js +30 -29
- package/dist/shared/components/MatrixEditor.js +497 -462
- package/dist/shared/components/MyWorkView.js +346 -272
- package/dist/shared/components/NotificationBell.js +215 -201
- package/dist/shared/components/PageRenderer.js +636 -599
- package/dist/shared/components/PresenceDot.js +21 -0
- package/dist/shared/components/ProfileView.js +656 -536
- package/dist/shared/components/RealtimeStatusBanner.js +25 -25
- package/dist/shared/components/RecentRecordsRail.js +51 -48
- package/dist/shared/components/RecordCompare.js +241 -150
- package/dist/shared/components/RecordDrilldownSheet.js +66 -64
- package/dist/shared/components/RecordGridEditor.js +350 -311
- package/dist/shared/components/RecordHoverCard.js +147 -0
- package/dist/shared/components/RecordPeekHost.js +111 -0
- package/dist/shared/components/RecordReadView.js +414 -412
- package/dist/shared/components/RelativeTime.js +16 -0
- package/dist/shared/components/ReportView.js +1396 -1304
- package/dist/shared/components/ScreenRefreshButton.js +77 -0
- package/dist/shared/components/TabCountHost.js +10 -0
- package/dist/shared/components/TickerNumber.js +19 -18
- package/dist/shared/components/TipLayer.js +70 -58
- package/dist/shared/components/WidgetImageMenu.js +59 -0
- package/dist/shared/components/WidgetSlot.js +571 -524
- package/dist/shared/components/activity/RecordActivityStream.js +317 -0
- package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
- package/dist/shared/components/cbv/approval-changed.js +20 -0
- package/dist/shared/components/cbv/changed-by-others.js +251 -0
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
- package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
- package/dist/shared/components/change-proposals/types.js +4 -0
- package/dist/shared/components/chat/ChatPanel.js +1571 -1528
- package/dist/shared/components/chat/Composer.js +276 -298
- package/dist/shared/components/chat/room-due.js +13 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
- package/dist/shared/components/collections-directory/directory-data.js +75 -63
- package/dist/shared/components/imports/ImportConsole.js +159 -155
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
- package/dist/shared/components/integrations/SendStatus.js +202 -0
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
- package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
- package/dist/shared/components/integrations/console/api.js +161 -117
- package/dist/shared/components/integrations/console/tone.js +15 -12
- package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
- package/dist/shared/components/item-edit/CloneDialog.js +208 -206
- package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
- package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
- package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
- package/dist/shared/components/item-edit/FieldComments.js +159 -116
- package/dist/shared/components/item-edit/FieldPointer.js +132 -0
- package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
- package/dist/shared/components/item-edit/FieldRow.js +519 -439
- package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
- package/dist/shared/components/item-edit/FilePickerField.js +454 -369
- package/dist/shared/components/item-edit/GroupSection.js +618 -567
- package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
- package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
- package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
- package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
- package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
- package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
- package/dist/shared/components/item-edit/PickerBadges.js +52 -0
- package/dist/shared/components/item-edit/PlanGrid.js +434 -439
- package/dist/shared/components/item-edit/RecalcValue.js +55 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
- package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
- package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
- package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
- package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
- package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
- package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
- package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
- package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
- package/dist/shared/components/item-edit/SectionPresence.js +78 -0
- package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
- package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
- package/dist/shared/components/item-edit/coedit/collab.js +84 -0
- package/dist/shared/components/item-edit/coedit/context.js +24 -0
- package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
- package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
- package/dist/shared/components/item-edit/coedit/session.js +382 -0
- package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
- package/dist/shared/components/item-edit/file-live.js +77 -0
- package/dist/shared/components/item-edit/file-processing.js +87 -0
- package/dist/shared/components/item-edit/layout-switch.js +148 -0
- package/dist/shared/components/item-edit/live-related.js +23 -0
- package/dist/shared/components/item-edit/live-title.js +66 -0
- package/dist/shared/components/item-edit/partner-needs.js +142 -0
- package/dist/shared/components/item-edit/removed-line.js +58 -0
- package/dist/shared/components/item-edit/render-stability.js +70 -59
- package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
- package/dist/shared/components/layout-editor/CollabParts.js +72 -70
- package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
- package/dist/shared/components/list/InlineEdit.js +504 -208
- package/dist/shared/components/list/ListViewers.js +81 -0
- package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
- package/dist/shared/components/merge/MergeWithFlow.js +290 -0
- package/dist/shared/components/merge/merge-values.js +110 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
- package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
- package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
- package/dist/shared/components/notifications/bundles.js +21 -19
- package/dist/shared/components/notifications/resolved-line.js +25 -0
- package/dist/shared/components/ops/OpsTasksView.js +45 -44
- package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
- package/dist/shared/components/panels/AlertBanners.js +132 -0
- package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
- package/dist/shared/components/panels/BranchLanes.js +82 -54
- package/dist/shared/components/panels/CommentAwareness.js +332 -0
- package/dist/shared/components/panels/CommentImages.js +219 -0
- package/dist/shared/components/panels/CommentPanel.js +649 -530
- package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
- package/dist/shared/components/panels/NewSinceChip.js +16 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
- package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
- package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
- package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
- package/dist/shared/components/panels/SlaClock.js +130 -99
- package/dist/shared/components/panels/TaskPanel.js +308 -287
- package/dist/shared/components/panels/unseen-move-check.js +101 -0
- package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
- package/dist/shared/components/profile/AgentNameField.js +141 -0
- package/dist/shared/components/profile/AgentsPanel.js +55 -46
- package/dist/shared/components/profile/PersonAccess.js +398 -330
- package/dist/shared/components/profile/PersonAdminTools.js +127 -113
- package/dist/shared/components/profile/PersonProfile.js +81 -73
- package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
- package/dist/shared/components/queue/QueueBulkBar.js +101 -84
- package/dist/shared/components/queue/QueueItemSheet.js +66 -66
- package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
- package/dist/shared/components/queue/QueueWorklist.js +1927 -1635
- package/dist/shared/components/send-view/SendViewButton.js +136 -0
- package/dist/shared/components/send-view/SentViewCards.js +147 -0
- package/dist/shared/components/support/ReportProblem.js +1 -0
- package/dist/shared/components/support/ScreenShare.js +554 -0
- package/dist/shared/components/support/SupportView.js +160 -129
- package/dist/shared/components/support/TicketDetailSheet.js +101 -89
- package/dist/shared/components/watch-list/WatchDock.js +1044 -0
- package/dist/shared/components/watch-list/WatchExtras.js +723 -0
- package/dist/shared/components/watch-list/WatchListButton.js +46 -0
- package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
- package/dist/shared/components/watch-list/WatchRows.js +348 -0
- package/dist/shared/lib/activity-sentence.js +87 -75
- package/dist/shared/lib/agent-presence.js +46 -0
- package/dist/shared/lib/approval-progress.js +49 -0
- package/dist/shared/lib/attention-prefs.js +27 -0
- package/dist/shared/lib/cell-locks.js +56 -0
- package/dist/shared/lib/co-edit.js +166 -0
- package/dist/shared/lib/coedit-registry.js +44 -0
- package/dist/shared/lib/comment-awareness.js +124 -0
- package/dist/shared/lib/comment-images.js +45 -0
- package/dist/shared/lib/config-watch.js +94 -0
- package/dist/shared/lib/copy-rules.js +65 -0
- package/dist/shared/lib/count-step.js +30 -0
- package/dist/shared/lib/deadline-ticker.js +68 -0
- package/dist/shared/lib/derived-causes.js +115 -0
- package/dist/shared/lib/draft-store.js +114 -85
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/field-merge.js +126 -0
- package/dist/shared/lib/filter-sentence.js +10 -10
- package/dist/shared/lib/focus-mode.js +16 -12
- package/dist/shared/lib/grid-cursors.js +77 -0
- package/dist/shared/lib/grid-presence.js +182 -0
- package/dist/shared/lib/idle-reload.js +100 -73
- package/dist/shared/lib/in-step.js +45 -0
- package/dist/shared/lib/integration-chip.js +19 -18
- package/dist/shared/lib/line-locks.js +141 -0
- package/dist/shared/lib/line-split.js +41 -0
- package/dist/shared/lib/linked-changes.js +150 -0
- package/dist/shared/lib/list-return.js +231 -0
- package/dist/shared/lib/list-viewers.js +52 -0
- package/dist/shared/lib/live-announcer.js +86 -0
- package/dist/shared/lib/live-counts.js +85 -0
- package/dist/shared/lib/live-data-changed.js +108 -0
- package/dist/shared/lib/live-deltas.js +81 -0
- package/dist/shared/lib/live-findings.js +113 -0
- package/dist/shared/lib/live-groups.js +122 -0
- package/dist/shared/lib/live-link-labels.js +162 -0
- package/dist/shared/lib/live-list-flow.js +334 -0
- package/dist/shared/lib/live-list.js +143 -129
- package/dist/shared/lib/live-moves.js +51 -0
- package/dist/shared/lib/live-ops.js +26 -26
- package/dist/shared/lib/live-pickers.js +7 -0
- package/dist/shared/lib/live-preference.js +184 -0
- package/dist/shared/lib/live-queries.js +226 -181
- package/dist/shared/lib/live-screen.js +333 -0
- package/dist/shared/lib/live-search.js +108 -0
- package/dist/shared/lib/live-seen.js +35 -0
- package/dist/shared/lib/live-views.js +100 -0
- package/dist/shared/lib/live.js +159 -133
- package/dist/shared/lib/missed-updates.js +198 -0
- package/dist/shared/lib/newer-file.js +56 -0
- package/dist/shared/lib/notification-sound.js +42 -20
- package/dist/shared/lib/own-writes.js +59 -41
- package/dist/shared/lib/picker-badges.js +94 -0
- package/dist/shared/lib/presence-signals.js +131 -84
- package/dist/shared/lib/realtime.js +49 -24
- package/dist/shared/lib/record-gaps.js +85 -0
- package/dist/shared/lib/record-outbox.js +369 -222
- package/dist/shared/lib/record-peek.js +75 -0
- package/dist/shared/lib/record-tabs.js +92 -72
- package/dist/shared/lib/relative-ticker.js +42 -0
- package/dist/shared/lib/request-gate.js +119 -119
- package/dist/shared/lib/rollup-recalc.js +107 -0
- package/dist/shared/lib/room-gaps.js +40 -36
- package/dist/shared/lib/rum.js +137 -87
- package/dist/shared/lib/save-progress.js +20 -0
- package/dist/shared/lib/scheduled-countdown.js +67 -0
- package/dist/shared/lib/screen-refresh.js +160 -0
- package/dist/shared/lib/screen-share.js +234 -0
- package/dist/shared/lib/seen-since.js +74 -0
- package/dist/shared/lib/selection-watch.js +205 -0
- package/dist/shared/lib/send-status.js +132 -0
- package/dist/shared/lib/send-view.js +23 -0
- package/dist/shared/lib/socket-liveness.js +155 -0
- package/dist/shared/lib/socket-realtime.js +168 -140
- package/dist/shared/lib/state-census.js +53 -0
- package/dist/shared/lib/summary-mode.js +61 -39
- package/dist/shared/lib/tab-attention.js +143 -32
- package/dist/shared/lib/table-density.js +64 -0
- package/dist/shared/lib/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +33 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-online-users.js +32 -11
- package/dist/shared/lib/user-sync.js +155 -39
- package/dist/shared/lib/waiting-count.js +44 -0
- package/dist/shared/lib/watch-desktop.js +83 -0
- package/dist/shared/lib/watch-list.js +447 -0
- package/dist/shared/lib/widget-image-render.js +64 -0
- package/dist/shared/lib/widget-image.js +111 -0
- package/dist/shared/lib/worker-socket.js +130 -104
- package/dist/shared/lib/write-to-screen.js +133 -0
- package/package.json +1 -1
- package/styles.css +49 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { jsx as l, jsxs as c, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Loader2 as
|
|
4
|
-
import { useState as N, useMemo as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as oe, patch as
|
|
7
|
-
import {
|
|
1
|
+
import { jsx as l, jsxs as c, Fragment as Ae } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as _e, useQuery as ue } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as me, X as ve, ChevronRight as Me } from "lucide-react";
|
|
4
|
+
import { useState as N, useMemo as I, useCallback as Fe, useRef as Re, useEffect as De } from "react";
|
|
5
|
+
import { useNivaroClient as $e } from "../context.js";
|
|
6
|
+
import { get as oe, patch as Se, post as be, del as Ce } from "../lib/commands.js";
|
|
7
|
+
import { useGridPresence as ze, gridPageKey as Pe, gridPresenceCell as Ve } from "../lib/grid-presence.js";
|
|
8
|
+
import { userErrorMessage as qe } from "../lib/safe-error.js";
|
|
8
9
|
import { cn as X } from "../lib/utils.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
10
|
+
import { GridPresenceLine as Ke } from "./GridPresenceLine.js";
|
|
11
|
+
import { ChangeReasonDialog as je, changeReasonChallenge as Oe } from "./item-edit/ChangeReasonDialog.js";
|
|
12
|
+
import { applyDisplayTemplate as Ge } from "./item-edit/helpers.js";
|
|
13
|
+
import { RelationCombobox as ye } from "./item-edit/RelationCombobox.js";
|
|
14
|
+
import { JsonMapEditor as Je } from "./JsonMapEditor.js";
|
|
15
|
+
import { colorPair as Ie } from "./QueryTable.js";
|
|
16
|
+
const U = [
|
|
15
17
|
"january",
|
|
16
18
|
"february",
|
|
17
19
|
"march",
|
|
@@ -24,7 +26,7 @@ const W = [
|
|
|
24
26
|
"october",
|
|
25
27
|
"november",
|
|
26
28
|
"december"
|
|
27
|
-
],
|
|
29
|
+
], Te = [
|
|
28
30
|
"Jan",
|
|
29
31
|
"Feb",
|
|
30
32
|
"Mar",
|
|
@@ -38,159 +40,159 @@ const W = [
|
|
|
38
40
|
"Nov",
|
|
39
41
|
"Dec"
|
|
40
42
|
];
|
|
41
|
-
function
|
|
42
|
-
return typeof t == "string" && t.startsWith("$scope.") ? m[t.slice(7)] : Array.isArray(t) ? t.map((
|
|
43
|
-
Object.entries(t).map(([
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
function Z(t, m) {
|
|
44
|
+
return typeof t == "string" && t.startsWith("$scope.") ? m[t.slice(7)] : Array.isArray(t) ? t.map(($) => Z($, m)) : t && typeof t == "object" ? Object.fromEntries(
|
|
45
|
+
Object.entries(t).map(([$, i]) => [
|
|
46
|
+
$,
|
|
47
|
+
Z(i, m)
|
|
46
48
|
])
|
|
47
49
|
) : t;
|
|
48
50
|
}
|
|
49
|
-
function
|
|
50
|
-
return t === void 0 ? !0 : Array.isArray(t) ? t.some(
|
|
51
|
+
function pe(t) {
|
|
52
|
+
return t === void 0 ? !0 : Array.isArray(t) ? t.some(pe) : t && typeof t == "object" ? Object.values(t).some(pe) : !1;
|
|
51
53
|
}
|
|
52
|
-
function
|
|
53
|
-
return t.browse ? /* @__PURE__ */ l(
|
|
54
|
+
function ut({ config: t }) {
|
|
55
|
+
return t.browse ? /* @__PURE__ */ l(Qe, { config: t }) : /* @__PURE__ */ l(Ue, { config: t });
|
|
54
56
|
}
|
|
55
|
-
function
|
|
56
|
-
var
|
|
57
|
-
const m =
|
|
57
|
+
function Ue({ config: t }) {
|
|
58
|
+
var re, le;
|
|
59
|
+
const m = $e(), $ = _e(), [i, p] = N({}), [S, g] = N({}), [C, q] = N([]), [k, y] = N(/* @__PURE__ */ new Set()), [G, z] = N(!1), [P, O] = N(null), [W, J] = N(null), [T, h] = N(null), v = (t.scope ?? []).every(
|
|
58
60
|
(r) => i[r.field] !== null && i[r.field] !== void 0 && i[r.field] !== ""
|
|
59
|
-
),
|
|
61
|
+
), _ = JSON.stringify(i), de = I(() => {
|
|
60
62
|
const r = [];
|
|
61
|
-
for (const
|
|
62
|
-
for (const
|
|
63
|
+
for (const o of t.month_sets ?? []) for (const n of U) r.push(`${n}${o.suffix}`);
|
|
64
|
+
for (const o of t.columns ?? []) r.push(o.field);
|
|
63
65
|
return r;
|
|
64
|
-
}, [t]), { data:
|
|
65
|
-
queryKey: ["record-grid-rows", t.collection,
|
|
66
|
+
}, [t]), { data: Y = [], isLoading: ne } = ue({
|
|
67
|
+
queryKey: ["record-grid-rows", t.collection, _],
|
|
66
68
|
queryFn: () => {
|
|
67
69
|
const r = {};
|
|
68
|
-
for (const
|
|
70
|
+
for (const o of t.scope ?? []) r[o.field] = { _eq: i[o.field] };
|
|
69
71
|
return m.request(
|
|
70
72
|
oe(`/items/${t.collection}`, {
|
|
71
73
|
limit: 2e3,
|
|
72
74
|
...Object.keys(r).length ? { filter: JSON.stringify(r) } : {}
|
|
73
75
|
})
|
|
74
|
-
).then((
|
|
76
|
+
).then((o) => o.data ?? []);
|
|
75
77
|
},
|
|
76
|
-
enabled:
|
|
78
|
+
enabled: v,
|
|
77
79
|
staleTime: 1e4
|
|
78
|
-
}), { data:
|
|
79
|
-
queryKey: ["record-grid-source", (
|
|
80
|
+
}), { data: D = [] } = ue({
|
|
81
|
+
queryKey: ["record-grid-source", (re = t.row_source) == null ? void 0 : re.collection, _],
|
|
80
82
|
queryFn: () => {
|
|
81
83
|
const r = t.row_source;
|
|
82
84
|
if (!r) return Promise.resolve([]);
|
|
83
|
-
const
|
|
85
|
+
const o = Z(r.filter, i), n = o && !pe(o) ? o : void 0;
|
|
84
86
|
return m.request(
|
|
85
87
|
oe(`/items/${r.collection}`, {
|
|
86
88
|
limit: 1e3,
|
|
87
89
|
...r.sort ? { sort: r.sort } : {},
|
|
88
90
|
...n ? { filter: JSON.stringify(n) } : {}
|
|
89
91
|
})
|
|
90
|
-
).then((
|
|
92
|
+
).then((f) => f.data ?? []);
|
|
91
93
|
},
|
|
92
|
-
enabled:
|
|
94
|
+
enabled: v && !!t.row_source,
|
|
93
95
|
staleTime: 3e4
|
|
94
|
-
}), j =
|
|
96
|
+
}), j = I(() => {
|
|
95
97
|
if (t.row_source) {
|
|
96
98
|
const r = t.row_source;
|
|
97
|
-
return
|
|
98
|
-
const n =
|
|
99
|
+
return D.map((o) => {
|
|
100
|
+
const n = Y.find((f) => String(f[r.fk_field]) === String(o.id)) ?? null;
|
|
99
101
|
return {
|
|
100
|
-
key: `src-${
|
|
102
|
+
key: `src-${o.id}`,
|
|
101
103
|
record: n,
|
|
102
|
-
sourceId:
|
|
103
|
-
sourceLabel: String(
|
|
104
|
+
sourceId: o.id,
|
|
105
|
+
sourceLabel: String(o[r.label_field] ?? o.id),
|
|
104
106
|
isNew: !n
|
|
105
107
|
};
|
|
106
108
|
});
|
|
107
109
|
}
|
|
108
110
|
return [
|
|
109
|
-
...
|
|
110
|
-
...
|
|
111
|
+
...Y.filter((r) => !k.has(String(r.id))).map((r) => ({ key: `rec-${r.id}`, record: r, isNew: !1 })),
|
|
112
|
+
...C.map((r) => ({ key: r, record: null, isNew: !0 }))
|
|
111
113
|
];
|
|
112
|
-
}, [t.row_source,
|
|
113
|
-
var
|
|
114
|
-
const n = (
|
|
114
|
+
}, [t.row_source, D, Y, C, k]), B = (r, o) => {
|
|
115
|
+
var F, x;
|
|
116
|
+
const n = (F = S[r.key]) == null ? void 0 : F[o];
|
|
115
117
|
if (n !== void 0) return n;
|
|
116
|
-
const
|
|
117
|
-
return
|
|
118
|
-
}, w = (r,
|
|
119
|
-
async function
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
let
|
|
118
|
+
const f = (x = r.record) == null ? void 0 : x[o];
|
|
119
|
+
return f == null ? "" : String(f);
|
|
120
|
+
}, w = (r, o, n) => g((f) => ({ ...f, [r]: { ...f[r] ?? {}, [o]: n } })), ee = Object.values(S).some((r) => Object.keys(r).length > 0) || C.length > 0 || k.size > 0;
|
|
121
|
+
async function E(r) {
|
|
122
|
+
var F;
|
|
123
|
+
z(!0), J(null);
|
|
124
|
+
let o = 0, n = 0, f = 0;
|
|
123
125
|
try {
|
|
124
|
-
for (const
|
|
125
|
-
const
|
|
126
|
-
if (!
|
|
127
|
-
const
|
|
128
|
-
for (const [
|
|
129
|
-
!de.includes(
|
|
130
|
-
if (t.computed_total_field && ((
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
var
|
|
134
|
-
const
|
|
135
|
-
return
|
|
126
|
+
for (const x of j) {
|
|
127
|
+
const R = S[x.key] ?? {}, ie = Object.keys(R).length > 0;
|
|
128
|
+
if (!x.record && !ie) continue;
|
|
129
|
+
const L = {};
|
|
130
|
+
for (const [A, M] of Object.entries(R))
|
|
131
|
+
!de.includes(A) && !(t.key_columns ?? []).some((V) => V.field === A) || (L[A] = M === "" ? null : Number.isNaN(Number(M)) ? M : Number(M));
|
|
132
|
+
if (t.computed_total_field && ((F = t.month_sets) != null && F.length)) {
|
|
133
|
+
const A = t.month_sets[0];
|
|
134
|
+
L[t.computed_total_field] = U.reduce((M, V) => {
|
|
135
|
+
var Q;
|
|
136
|
+
const ae = `${V}${A.suffix}`, he = R[ae] !== void 0 ? Number(R[ae]) || 0 : Number((Q = x.record) == null ? void 0 : Q[ae]) || 0;
|
|
137
|
+
return M + he;
|
|
136
138
|
}, 0);
|
|
137
139
|
}
|
|
138
|
-
if (
|
|
139
|
-
if (Object.keys(
|
|
140
|
-
r && (
|
|
140
|
+
if (x.record) {
|
|
141
|
+
if (Object.keys(L).length === 0) continue;
|
|
142
|
+
r && (L._change_reason = r), await m.request(Se(`/items/${t.collection}/${x.record.id}`, L)), n++;
|
|
141
143
|
} else {
|
|
142
|
-
if (!
|
|
143
|
-
for (const
|
|
144
|
-
t.row_source && (
|
|
144
|
+
if (!ie) continue;
|
|
145
|
+
for (const A of t.scope ?? []) L[A.field] = i[A.field];
|
|
146
|
+
t.row_source && (L[t.row_source.fk_field] = x.sourceId), await m.request(be(`/items/${t.collection}`, L)), o++;
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
|
-
for (const
|
|
148
|
-
await m.request(
|
|
149
|
+
for (const x of k)
|
|
150
|
+
await m.request(Ce(`/items/${t.collection}/${x}`)), f++;
|
|
149
151
|
if (t.after_save) {
|
|
150
|
-
const
|
|
152
|
+
const x = Z(t.after_save.params ?? {}, i);
|
|
151
153
|
await m.request(
|
|
152
|
-
|
|
154
|
+
be(`/custom-queries/${t.after_save.query_slug}/execute`, { params: x })
|
|
153
155
|
);
|
|
154
156
|
}
|
|
155
|
-
|
|
156
|
-
`Saved — ${n} updated, ${
|
|
157
|
+
g({}), q([]), y(/* @__PURE__ */ new Set()), await $.invalidateQueries({ queryKey: ["record-grid-rows", t.collection] }), J(
|
|
158
|
+
`Saved — ${n} updated, ${o} created${f ? `, ${f} deleted` : ""}`
|
|
157
159
|
);
|
|
158
|
-
} catch (
|
|
159
|
-
const
|
|
160
|
-
|
|
160
|
+
} catch (x) {
|
|
161
|
+
const R = Oe(x);
|
|
162
|
+
R ? (O(R), J(null)) : J(`Save failed: ${qe(x, "unknown error")}`);
|
|
161
163
|
} finally {
|
|
162
|
-
|
|
164
|
+
z(!1);
|
|
163
165
|
}
|
|
164
166
|
}
|
|
165
|
-
const
|
|
167
|
+
const te = [
|
|
166
168
|
...(t.month_sets ?? []).flatMap(
|
|
167
|
-
(r) =>
|
|
169
|
+
(r) => U.map((o, n) => ({ field: `${o}${r.suffix}`, label: `${Te[n]} ${r.label}` }))
|
|
168
170
|
),
|
|
169
171
|
...(t.columns ?? []).map((r) => ({ field: r.field, label: r.label ?? r.field }))
|
|
170
172
|
];
|
|
171
173
|
return /* @__PURE__ */ c("div", { className: "flex h-full flex-col gap-3 overflow-auto p-3", children: [
|
|
172
174
|
/* @__PURE__ */ l(
|
|
173
|
-
|
|
175
|
+
je,
|
|
174
176
|
{
|
|
175
|
-
challenge:
|
|
177
|
+
challenge: P,
|
|
176
178
|
onCancel: () => O(null),
|
|
177
179
|
onSubmit: (r) => {
|
|
178
|
-
O(null),
|
|
180
|
+
O(null), E(r);
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
),
|
|
182
184
|
/* @__PURE__ */ c("div", { className: "flex flex-wrap items-end gap-3", children: [
|
|
183
185
|
(t.scope ?? []).map((r) => {
|
|
184
|
-
const
|
|
186
|
+
const o = Z(r.filter, i), n = o && !pe(o) ? o : void 0;
|
|
185
187
|
return /* @__PURE__ */ c("div", { className: "w-52", children: [
|
|
186
|
-
/* @__PURE__ */ l("p", { className: "mb-1 text-[11px] font-medium text-slate-500", children: r.label ?? r.field.replace(/_/g, " ").replace(/\b\w/g, (
|
|
188
|
+
/* @__PURE__ */ l("p", { className: "mb-1 text-[11px] font-medium text-slate-500", children: r.label ?? r.field.replace(/_/g, " ").replace(/\b\w/g, (f) => f.toUpperCase()) }),
|
|
187
189
|
/* @__PURE__ */ l(
|
|
188
|
-
|
|
190
|
+
ye,
|
|
189
191
|
{
|
|
190
192
|
collection: r.collection,
|
|
191
193
|
value: i[r.field] ?? null,
|
|
192
|
-
onChange: (
|
|
193
|
-
p((
|
|
194
|
+
onChange: (f) => {
|
|
195
|
+
p((F) => ({ ...F, [r.field]: f })), g({}), q([]), y(/* @__PURE__ */ new Set());
|
|
194
196
|
},
|
|
195
197
|
extraFilter: n,
|
|
196
198
|
placeholder: "Select…"
|
|
@@ -202,27 +204,27 @@ function De({ config: t }) {
|
|
|
202
204
|
"button",
|
|
203
205
|
{
|
|
204
206
|
type: "button",
|
|
205
|
-
disabled: !
|
|
206
|
-
onClick: () => void
|
|
207
|
+
disabled: !v || !ee || G,
|
|
208
|
+
onClick: () => void E(),
|
|
207
209
|
className: "inline-flex h-9 items-center gap-1.5 rounded-md bg-nvr-cyan px-3 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",
|
|
208
210
|
children: [
|
|
209
|
-
|
|
211
|
+
G && /* @__PURE__ */ l(me, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
210
212
|
"Save changes"
|
|
211
213
|
]
|
|
212
214
|
}
|
|
213
215
|
),
|
|
214
|
-
t.allow_add &&
|
|
216
|
+
t.allow_add && v && /* @__PURE__ */ l(
|
|
215
217
|
"button",
|
|
216
218
|
{
|
|
217
219
|
type: "button",
|
|
218
|
-
onClick: () =>
|
|
220
|
+
onClick: () => q((r) => [...r, `new-${r.length}-${Math.random().toString(36).slice(2, 8)}`]),
|
|
219
221
|
className: "inline-flex h-9 items-center rounded-md border border-slate-200 bg-white px-3 text-[13px] text-slate-700 hover:border-slate-400 dark:border-border dark:bg-card dark:text-slate-200",
|
|
220
222
|
children: "+ Add row"
|
|
221
223
|
}
|
|
222
224
|
),
|
|
223
|
-
(t.toolbar_editors ?? []).map((r,
|
|
225
|
+
(t.toolbar_editors ?? []).map((r, o) => {
|
|
224
226
|
const n = (r.require_scope ?? []).every(
|
|
225
|
-
(
|
|
227
|
+
(f) => i[f] !== null && i[f] !== void 0 && i[f] !== ""
|
|
226
228
|
);
|
|
227
229
|
return /* @__PURE__ */ l(
|
|
228
230
|
"button",
|
|
@@ -230,50 +232,50 @@ function De({ config: t }) {
|
|
|
230
232
|
type: "button",
|
|
231
233
|
disabled: !n,
|
|
232
234
|
title: n ? void 0 : `Choose ${(r.require_scope ?? []).join(", ")} first`,
|
|
233
|
-
onClick: () =>
|
|
235
|
+
onClick: () => h(o),
|
|
234
236
|
className: "inline-flex h-9 items-center rounded-md border border-slate-200 bg-white px-3 text-[13px] text-slate-700 hover:border-slate-400 disabled:opacity-50 dark:border-border dark:bg-card dark:text-slate-200",
|
|
235
237
|
children: r.button_label
|
|
236
238
|
},
|
|
237
239
|
r.button_label
|
|
238
240
|
);
|
|
239
241
|
}),
|
|
240
|
-
|
|
242
|
+
W && /* @__PURE__ */ l("span", { className: "pb-2 text-[12px] text-slate-500", children: W })
|
|
241
243
|
] }),
|
|
242
|
-
|
|
244
|
+
T !== null && ((le = t.toolbar_editors) == null ? void 0 : le[T]) && /* @__PURE__ */ l(
|
|
243
245
|
"div",
|
|
244
246
|
{
|
|
245
247
|
className: "fixed inset-0 z-[60] flex justify-end bg-black/30",
|
|
246
|
-
onClick: () =>
|
|
248
|
+
onClick: () => h(null),
|
|
247
249
|
children: /* @__PURE__ */ c(
|
|
248
250
|
"div",
|
|
249
251
|
{
|
|
250
252
|
className: "flex h-full flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-border dark:bg-background",
|
|
251
253
|
style: {
|
|
252
|
-
width: typeof t.toolbar_editors[
|
|
254
|
+
width: typeof t.toolbar_editors[T].sheet_width == "number" ? `${t.toolbar_editors[T].sheet_width}px` : t.toolbar_editors[T].sheet_width ?? "70%",
|
|
253
255
|
maxWidth: "96%"
|
|
254
256
|
},
|
|
255
257
|
onClick: (r) => r.stopPropagation(),
|
|
256
258
|
children: [
|
|
257
259
|
/* @__PURE__ */ c("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
258
|
-
/* @__PURE__ */ l("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: t.toolbar_editors[
|
|
260
|
+
/* @__PURE__ */ l("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: t.toolbar_editors[T].button_label }),
|
|
259
261
|
/* @__PURE__ */ l(
|
|
260
262
|
"button",
|
|
261
263
|
{
|
|
262
264
|
type: "button",
|
|
263
|
-
onClick: () =>
|
|
265
|
+
onClick: () => h(null),
|
|
264
266
|
className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
265
267
|
children: "Close"
|
|
266
268
|
}
|
|
267
269
|
)
|
|
268
270
|
] }),
|
|
269
|
-
/* @__PURE__ */ l("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ l(
|
|
271
|
+
/* @__PURE__ */ l("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ l(Je, { config: t.toolbar_editors[T].json_map, scope: i }) })
|
|
270
272
|
]
|
|
271
273
|
}
|
|
272
274
|
)
|
|
273
275
|
}
|
|
274
276
|
),
|
|
275
|
-
|
|
276
|
-
/* @__PURE__ */ l(
|
|
277
|
+
v ? ne ? /* @__PURE__ */ c("div", { className: "flex items-center gap-2 text-[12px] text-slate-400", children: [
|
|
278
|
+
/* @__PURE__ */ l(me, { className: "h-4 w-4 animate-spin" }),
|
|
277
279
|
" Loading…"
|
|
278
280
|
] }) : /* @__PURE__ */ l("div", { className: "overflow-x-auto", children: /* @__PURE__ */ c("table", { className: "w-full text-[12px]", children: [
|
|
279
281
|
/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ c("tr", { className: "border-b border-slate-200 text-left dark:border-border", children: [
|
|
@@ -286,7 +288,7 @@ function De({ config: t }) {
|
|
|
286
288
|
},
|
|
287
289
|
r.field
|
|
288
290
|
)),
|
|
289
|
-
|
|
291
|
+
te.map((r) => /* @__PURE__ */ l(
|
|
290
292
|
"th",
|
|
291
293
|
{
|
|
292
294
|
className: "min-w-[86px] py-1.5 pr-2 text-right font-medium text-slate-500",
|
|
@@ -302,38 +304,38 @@ function De({ config: t }) {
|
|
|
302
304
|
r.sourceLabel,
|
|
303
305
|
r.isNew && /* @__PURE__ */ l("span", { className: "ml-1.5 text-[10px] text-slate-400", children: "(new)" })
|
|
304
306
|
] }),
|
|
305
|
-
(t.key_columns ?? []).map((
|
|
306
|
-
|
|
307
|
+
(t.key_columns ?? []).map((o) => /* @__PURE__ */ l("td", { className: "py-1 pr-3", children: /* @__PURE__ */ l(
|
|
308
|
+
ye,
|
|
307
309
|
{
|
|
308
|
-
collection:
|
|
309
|
-
value:
|
|
310
|
-
onChange: (n) => w(r.key,
|
|
310
|
+
collection: o.collection,
|
|
311
|
+
value: B(r, o.field) || null,
|
|
312
|
+
onChange: (n) => w(r.key, o.field, n == null ? "" : String(n)),
|
|
311
313
|
placeholder: "Select…"
|
|
312
314
|
}
|
|
313
|
-
) },
|
|
314
|
-
|
|
315
|
+
) }, o.field)),
|
|
316
|
+
te.map((o) => /* @__PURE__ */ l("td", { className: "py-0.5 pr-2 text-right", children: /* @__PURE__ */ l(
|
|
315
317
|
"input",
|
|
316
318
|
{
|
|
317
319
|
type: "number",
|
|
318
320
|
min: t.allow_negative ? void 0 : 0,
|
|
319
|
-
value:
|
|
320
|
-
title: t.allow_negative ? void 0 :
|
|
321
|
+
value: B(r, o.field),
|
|
322
|
+
title: t.allow_negative ? void 0 : Ee,
|
|
321
323
|
onChange: (n) => {
|
|
322
|
-
!t.allow_negative && n.target.value.trim().startsWith("-") || w(r.key,
|
|
324
|
+
!t.allow_negative && n.target.value.trim().startsWith("-") || w(r.key, o.field, n.target.value);
|
|
323
325
|
},
|
|
324
326
|
className: "h-7 w-[84px] rounded border border-slate-200 bg-white px-1.5 text-right text-[12px] tabular-nums outline-none focus:border-nvr-cyan dark:border-border dark:bg-background"
|
|
325
327
|
}
|
|
326
|
-
) },
|
|
328
|
+
) }, o.field)),
|
|
327
329
|
t.allow_delete && /* @__PURE__ */ l("td", { className: "py-1 pl-2", children: /* @__PURE__ */ l(
|
|
328
330
|
"button",
|
|
329
331
|
{
|
|
330
332
|
type: "button",
|
|
331
333
|
onClick: () => {
|
|
332
|
-
r.record ?
|
|
334
|
+
r.record ? y((o) => {
|
|
333
335
|
var n;
|
|
334
|
-
return new Set(
|
|
335
|
-
}) :
|
|
336
|
-
const n = { ...
|
|
336
|
+
return new Set(o).add(String((n = r.record) == null ? void 0 : n.id));
|
|
337
|
+
}) : q((o) => o.filter((n) => n !== r.key)), g((o) => {
|
|
338
|
+
const n = { ...o };
|
|
337
339
|
return delete n[r.key], n;
|
|
338
340
|
});
|
|
339
341
|
},
|
|
@@ -346,8 +348,8 @@ function De({ config: t }) {
|
|
|
346
348
|
] }),
|
|
347
349
|
/* @__PURE__ */ l("tfoot", { children: /* @__PURE__ */ c("tr", { className: "border-t border-slate-300 font-semibold dark:border-border", children: [
|
|
348
350
|
t.row_source && /* @__PURE__ */ l("td", { className: "py-1.5 pr-3", children: "Total" }),
|
|
349
|
-
(t.key_columns ?? []).map((r,
|
|
350
|
-
|
|
351
|
+
(t.key_columns ?? []).map((r, o) => /* @__PURE__ */ l("td", { className: "py-1.5 pr-3", children: !t.row_source && o === 0 ? "Total" : "" }, r.field)),
|
|
352
|
+
te.map((r) => /* @__PURE__ */ l("td", { className: "py-1.5 pr-2 text-right tabular-nums", children: j.reduce((o, n) => o + (Number(B(n, r.field)) || 0), 0).toLocaleString("en-US", { maximumFractionDigits: 2 }) }, r.field)),
|
|
351
353
|
t.allow_delete && /* @__PURE__ */ l("td", {})
|
|
352
354
|
] }) })
|
|
353
355
|
] }) }) : /* @__PURE__ */ c("p", { className: "text-[12px] text-slate-400", children: [
|
|
@@ -357,215 +359,234 @@ function De({ config: t }) {
|
|
|
357
359
|
] })
|
|
358
360
|
] });
|
|
359
361
|
}
|
|
360
|
-
const K = (t, m) => t == null || !Number.isFinite(t) || m != null && m.blankZero && t === 0 ? "—" : t.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }),
|
|
361
|
-
function
|
|
362
|
-
const
|
|
363
|
-
if (
|
|
364
|
-
const i =
|
|
365
|
-
return { value: `${i}${
|
|
362
|
+
const K = (t, m) => t == null || !Number.isFinite(t) || m != null && m.blankZero && t === 0 ? "—" : t.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }), Ee = "Enter an amount of zero or more";
|
|
363
|
+
function We(t, m) {
|
|
364
|
+
const $ = t.replace(/[^\d.-]/g, "");
|
|
365
|
+
if ($.includes("-") && !m) return { value: null, refused: Ee };
|
|
366
|
+
const i = $.startsWith("-") ? "-" : "", p = $.replace(/-/g, ""), S = p.indexOf("."), g = S < 0 ? p : `${p.slice(0, S + 1)}${p.slice(S + 1).replace(/\./g, "")}`;
|
|
367
|
+
return { value: `${i}${g}`, refused: null };
|
|
366
368
|
}
|
|
367
|
-
function
|
|
369
|
+
function Be({
|
|
368
370
|
value: t,
|
|
369
371
|
original: m,
|
|
370
|
-
onChange:
|
|
372
|
+
onChange: $,
|
|
371
373
|
disabled: i,
|
|
372
374
|
allowNegative: p = !1
|
|
373
375
|
}) {
|
|
374
|
-
const [
|
|
376
|
+
const [S, g] = N(!1), [C, q] = N(null), k = t !== m, y = t === "" ? null : Number(t), G = S || y == null || Number.isNaN(y) ? t : K(y), z = k && y != null && !Number.isNaN(y) ? y - (Number(m) || 0) : 0;
|
|
375
377
|
return /* @__PURE__ */ c("span", { className: "relative inline-block", children: [
|
|
376
378
|
/* @__PURE__ */ l(
|
|
377
379
|
"input",
|
|
378
380
|
{
|
|
379
381
|
type: "text",
|
|
380
382
|
inputMode: "decimal",
|
|
381
|
-
value:
|
|
383
|
+
value: G,
|
|
382
384
|
disabled: i,
|
|
383
|
-
"aria-invalid":
|
|
384
|
-
title:
|
|
385
|
-
onFocus: (
|
|
386
|
-
|
|
387
|
-
const O =
|
|
385
|
+
"aria-invalid": C ? !0 : void 0,
|
|
386
|
+
title: C ?? (k ? `Was ${K(Number(m) || 0)} (${z >= 0 ? "+" : "−"}${K(Math.abs(z))})` : void 0),
|
|
387
|
+
onFocus: (P) => {
|
|
388
|
+
g(!0);
|
|
389
|
+
const O = P.currentTarget;
|
|
388
390
|
requestAnimationFrame(() => {
|
|
389
391
|
document.activeElement === O && O.select();
|
|
390
392
|
});
|
|
391
393
|
},
|
|
392
394
|
onBlur: () => {
|
|
393
|
-
|
|
395
|
+
g(!1), q(null);
|
|
394
396
|
},
|
|
395
|
-
onChange: (
|
|
396
|
-
const O =
|
|
397
|
-
|
|
397
|
+
onChange: (P) => {
|
|
398
|
+
const O = We(P.target.value, p);
|
|
399
|
+
q(O.refused), O.value != null && $(O.value);
|
|
398
400
|
},
|
|
399
401
|
className: X(
|
|
400
402
|
"h-7 w-[92px] rounded-md border bg-white px-1.5 text-right text-[12px] tabular-nums outline-none transition-colors focus:border-nvr-cyan disabled:bg-transparent dark:bg-background",
|
|
401
|
-
|
|
402
|
-
!
|
|
403
|
+
C ? "border-red-400 focus:border-red-400" : k ? "border-nvr-cyan bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/10" : "border-slate-200 dark:border-border",
|
|
404
|
+
!k && (y === 0 || y == null) && "text-slate-400"
|
|
403
405
|
)
|
|
404
406
|
}
|
|
405
407
|
),
|
|
406
|
-
|
|
408
|
+
C && /* @__PURE__ */ l(
|
|
407
409
|
"span",
|
|
408
410
|
{
|
|
409
411
|
role: "alert",
|
|
410
412
|
className: "absolute right-0 top-full z-10 mt-0.5 whitespace-nowrap rounded bg-red-600 px-1.5 py-0.5 text-[10.5px] font-medium text-white shadow",
|
|
411
|
-
children:
|
|
413
|
+
children: C
|
|
412
414
|
}
|
|
413
415
|
)
|
|
414
416
|
] });
|
|
415
417
|
}
|
|
416
|
-
function
|
|
417
|
-
var
|
|
418
|
-
const m =
|
|
418
|
+
function Qe({ config: t }) {
|
|
419
|
+
var we, ge, ke;
|
|
420
|
+
const m = $e(), $ = _e(), i = t.key_columns ?? [], [p, S] = N({}), [g, C] = N({}), [q, k] = N([]), [y, G] = N(/* @__PURE__ */ new Set()), [z, P] = N(!1), [O, W] = N(null), [J, T] = N(null), h = i.length > 0 && i.every((e) => p[e.field] != null && p[e.field] !== ""), v = I(() => {
|
|
419
421
|
const e = (t.month_sets ?? []).flatMap(
|
|
420
|
-
(a) =>
|
|
422
|
+
(a) => U.map((d, u) => ({
|
|
421
423
|
field: `${d}${a.suffix}`,
|
|
422
|
-
label: `${
|
|
424
|
+
label: `${Te[u]}${a.label ? ` ${a.label}` : ""}`
|
|
423
425
|
}))
|
|
424
|
-
),
|
|
426
|
+
), s = (t.columns ?? []).map((a) => ({
|
|
425
427
|
field: a.field,
|
|
426
428
|
label: a.label ?? a.field
|
|
427
429
|
}));
|
|
428
|
-
return [...e, ...
|
|
429
|
-
}, [t.month_sets, t.columns]),
|
|
430
|
+
return [...e, ...s];
|
|
431
|
+
}, [t.month_sets, t.columns]), _ = (we = t.month_sets) == null ? void 0 : we[0], { data: de = [], isLoading: Y } = ue({
|
|
430
432
|
queryKey: ["record-grid-browse-rows", t.collection],
|
|
431
433
|
queryFn: () => m.request(
|
|
432
434
|
oe(`/items/${t.collection}`, { limit: 5e3 })
|
|
433
435
|
).then((e) => e.data ?? []),
|
|
434
436
|
staleTime: 1e4
|
|
435
|
-
}), { data: ne = {} } =
|
|
437
|
+
}), { data: ne = {} } = ue({
|
|
436
438
|
queryKey: ["record-grid-browse-labels", i.map((e) => e.collection).join(",")],
|
|
437
439
|
queryFn: async () => {
|
|
438
440
|
const e = {};
|
|
439
441
|
return await Promise.all(
|
|
440
|
-
i.map(async (
|
|
442
|
+
i.map(async (s) => {
|
|
441
443
|
const a = await m.request(
|
|
442
|
-
oe(`/collections/${
|
|
444
|
+
oe(`/collections/${s.collection}`)
|
|
443
445
|
).then((b) => b.data).catch(() => null), d = await m.request(
|
|
444
|
-
oe(`/items/${
|
|
446
|
+
oe(`/items/${s.collection}`, { limit: 1e3 })
|
|
445
447
|
).then((b) => b.data ?? []).catch(() => []), u = /* @__PURE__ */ new Map();
|
|
446
448
|
for (const b of d)
|
|
447
|
-
u.set(String(b.id),
|
|
448
|
-
e[
|
|
449
|
+
u.set(String(b.id), Ge(a == null ? void 0 : a.display_template, b) || String(b.id));
|
|
450
|
+
e[s.field] = u;
|
|
449
451
|
})
|
|
450
452
|
), e;
|
|
451
453
|
},
|
|
452
454
|
enabled: i.length > 0,
|
|
453
455
|
staleTime: 3e5
|
|
454
|
-
}),
|
|
455
|
-
(e,
|
|
456
|
+
}), D = Fe(
|
|
457
|
+
(e, s) => {
|
|
456
458
|
var a;
|
|
457
|
-
return
|
|
459
|
+
return s == null ? "—" : ((a = ne[e]) == null ? void 0 : a.get(String(s))) ?? String(s);
|
|
458
460
|
},
|
|
459
461
|
[ne]
|
|
460
|
-
), j =
|
|
462
|
+
), j = I(
|
|
461
463
|
() => de.filter(
|
|
462
464
|
(e) => i.every(
|
|
463
|
-
(
|
|
465
|
+
(s) => p[s.field] == null || p[s.field] === "" || String(e[s.field]) === String(p[s.field])
|
|
464
466
|
)
|
|
465
467
|
),
|
|
466
468
|
[de, i, p]
|
|
467
|
-
),
|
|
468
|
-
if (
|
|
469
|
+
), B = (ge = i[0]) == null ? void 0 : ge.field, w = i.filter((e) => p[e.field] == null || p[e.field] === ""), ee = I(() => {
|
|
470
|
+
if (h) return [];
|
|
469
471
|
const e = /* @__PURE__ */ new Map();
|
|
470
|
-
for (const
|
|
472
|
+
for (const s of j) {
|
|
471
473
|
const a = {};
|
|
472
|
-
for (const b of w) a[b.field] =
|
|
473
|
-
const d = w.map((b) => String(
|
|
474
|
-
for (const b of
|
|
475
|
-
u.sums[b.field] = (u.sums[b.field] ?? 0) + (Number(
|
|
474
|
+
for (const b of w) a[b.field] = s[b.field];
|
|
475
|
+
const d = w.map((b) => String(s[b.field] ?? "")).join("|"), u = e.get(d) ?? { keyVals: a, sums: {}, count: 0 };
|
|
476
|
+
for (const b of v)
|
|
477
|
+
u.sums[b.field] = (u.sums[b.field] ?? 0) + (Number(s[b.field]) || 0);
|
|
476
478
|
u.count++, e.set(d, u);
|
|
477
479
|
}
|
|
478
|
-
return [...e.values()].sort((
|
|
480
|
+
return [...e.values()].sort((s, a) => {
|
|
479
481
|
for (const d of w) {
|
|
480
|
-
const u =
|
|
481
|
-
|
|
482
|
+
const u = D(d.field, s.keyVals[d.field]).localeCompare(
|
|
483
|
+
D(d.field, a.keyVals[d.field]),
|
|
482
484
|
void 0,
|
|
483
485
|
{ numeric: !0 }
|
|
484
486
|
);
|
|
485
|
-
if (u) return d.field ===
|
|
487
|
+
if (u) return d.field === B ? -u : u;
|
|
486
488
|
}
|
|
487
489
|
return 0;
|
|
488
490
|
});
|
|
489
|
-
}, [j, w,
|
|
490
|
-
...j.filter((e) => !
|
|
491
|
-
...
|
|
492
|
-
] : [], [j,
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
491
|
+
}, [j, w, h, v, D, B]), E = I(() => h ? [
|
|
492
|
+
...j.filter((e) => !y.has(String(e.id))).map((e) => ({ key: `rec-${e.id}`, record: e, isNew: !1 })),
|
|
493
|
+
...q.map((e) => ({ key: e, record: null, isNew: !0 }))
|
|
494
|
+
] : [], [j, h, q, y]), fe = Re(null), te = I(
|
|
495
|
+
() => E.filter((e) => {
|
|
496
|
+
var s;
|
|
497
|
+
return ((s = e.record) == null ? void 0 : s.id) != null;
|
|
498
|
+
}).map((e) => {
|
|
499
|
+
var s;
|
|
500
|
+
return String((s = e.record) == null ? void 0 : s.id);
|
|
501
|
+
}),
|
|
502
|
+
[E]
|
|
503
|
+
), { editors: re } = ze({
|
|
504
|
+
page: Pe(
|
|
505
|
+
"rgrid",
|
|
506
|
+
t.collection,
|
|
507
|
+
...i.map((e) => String(p[e.field] ?? ""))
|
|
508
|
+
),
|
|
509
|
+
collection: t.collection,
|
|
510
|
+
items: te,
|
|
511
|
+
containerRef: fe,
|
|
512
|
+
enabled: h
|
|
513
|
+
}), le = i.map((e) => D(e.field, p[e.field])).join(" · ");
|
|
514
|
+
De(() => {
|
|
515
|
+
h && j.length === 0 && q.length === 0 && y.size === 0 && k([`new-${Date.now()}`]);
|
|
516
|
+
}, [h, j.length, q.length, y.size]);
|
|
517
|
+
const r = (e, s) => {
|
|
497
518
|
var u, b;
|
|
498
|
-
const a = (u =
|
|
519
|
+
const a = (u = g[e.key]) == null ? void 0 : u[s];
|
|
499
520
|
if (a !== void 0) return a;
|
|
500
|
-
const d = (b = e.record) == null ? void 0 : b[
|
|
521
|
+
const d = (b = e.record) == null ? void 0 : b[s];
|
|
501
522
|
return d == null ? "" : String(d);
|
|
502
|
-
},
|
|
523
|
+
}, o = (e, s) => {
|
|
503
524
|
var d;
|
|
504
|
-
const a = (d = e.record) == null ? void 0 : d[
|
|
525
|
+
const a = (d = e.record) == null ? void 0 : d[s];
|
|
505
526
|
return a == null ? "" : String(a);
|
|
506
|
-
},
|
|
507
|
-
|
|
508
|
-
},
|
|
509
|
-
|
|
510
|
-
},
|
|
511
|
-
|
|
527
|
+
}, n = (e, s, a) => C((d) => ({ ...d, [e]: { ...d[e] ?? {}, [s]: a } })), f = (e) => _ ? U.reduce((s, a) => s + (Number(r(e, `${a}${_.suffix}`)) || 0), 0) : null, F = Object.values(g).some((e) => Object.keys(e).length > 0) || y.size > 0 || q.some((e) => Object.keys(g[e] ?? {}).length > 0), x = () => {
|
|
528
|
+
C({}), k([]), G(/* @__PURE__ */ new Set());
|
|
529
|
+
}, R = (e) => {
|
|
530
|
+
S((s) => ({ ...s, ...e })), x();
|
|
531
|
+
}, ie = (e, s) => {
|
|
532
|
+
S((a) => ({ ...a, [e]: s })), x();
|
|
512
533
|
};
|
|
513
|
-
async function
|
|
514
|
-
|
|
515
|
-
let
|
|
534
|
+
async function L(e) {
|
|
535
|
+
P(!0), T(null);
|
|
536
|
+
let s = 0, a = 0, d = 0;
|
|
516
537
|
try {
|
|
517
|
-
for (const u of
|
|
518
|
-
const b =
|
|
538
|
+
for (const u of E) {
|
|
539
|
+
const b = g[u.key] ?? {};
|
|
519
540
|
if (Object.keys(b).length === 0) continue;
|
|
520
541
|
const H = {};
|
|
521
|
-
for (const [se,
|
|
522
|
-
|
|
523
|
-
if (t.computed_total_field &&
|
|
524
|
-
e && (H._change_reason = e), await m.request(
|
|
542
|
+
for (const [se, ce] of Object.entries(b))
|
|
543
|
+
v.some((Le) => Le.field === se) && (H[se] = ce === "" ? null : Number.isNaN(Number(ce)) ? ce : Number(ce));
|
|
544
|
+
if (t.computed_total_field && _ && (H[t.computed_total_field] = f(u)), u.record)
|
|
545
|
+
e && (H._change_reason = e), await m.request(Se(`/items/${t.collection}/${u.record.id}`, H)), a++;
|
|
525
546
|
else {
|
|
526
547
|
for (const se of i) H[se.field] = p[se.field];
|
|
527
|
-
await m.request(
|
|
548
|
+
await m.request(be(`/items/${t.collection}`, H)), s++;
|
|
528
549
|
}
|
|
529
550
|
}
|
|
530
|
-
for (const u of
|
|
531
|
-
await m.request(
|
|
551
|
+
for (const u of y)
|
|
552
|
+
await m.request(Ce(`/items/${t.collection}/${u}`)), d++;
|
|
532
553
|
if (t.after_save) {
|
|
533
|
-
const u =
|
|
554
|
+
const u = Z(t.after_save.params ?? {}, p);
|
|
534
555
|
await m.request(
|
|
535
|
-
|
|
556
|
+
be(`/custom-queries/${t.after_save.query_slug}/execute`, { params: u })
|
|
536
557
|
);
|
|
537
558
|
}
|
|
538
|
-
|
|
539
|
-
`Saved — ${a} updated, ${
|
|
559
|
+
x(), await $.invalidateQueries({ queryKey: ["record-grid-browse-rows", t.collection] }), T(
|
|
560
|
+
`Saved — ${a} updated, ${s} created${d ? `, ${d} deleted` : ""}`
|
|
540
561
|
);
|
|
541
562
|
} catch (u) {
|
|
542
|
-
const b =
|
|
543
|
-
b ?
|
|
563
|
+
const b = Oe(u);
|
|
564
|
+
b ? W(b) : T(`Save failed: ${qe(u, "unknown error")}`);
|
|
544
565
|
} finally {
|
|
545
|
-
|
|
566
|
+
P(!1);
|
|
546
567
|
}
|
|
547
568
|
}
|
|
548
|
-
const
|
|
569
|
+
const A = (e) => h ? E.reduce((s, a) => s + (Number(r(a, e)) || 0), 0) : ee.reduce((s, a) => s + (a.sums[e] ?? 0), 0), M = (e) => _ && e < 12 && e % 3 === 0 && e > 0, V = (e) => _ && e < 12 && Math.floor(e / 3) % 2 === 1 ? "bg-slate-50/70 dark:bg-muted/30" : "", [ae, he] = Ie("accent"), Q = { "--qtc": ae, "--qtcd": he }, xe = "text-[color:var(--qtc)] dark:text-[color:var(--qtcd)]", Ne = (e, s, a = "") => /* @__PURE__ */ l(
|
|
549
570
|
"th",
|
|
550
571
|
{
|
|
551
572
|
className: X(
|
|
552
573
|
"whitespace-nowrap px-2 py-2 text-right text-[10.5px] font-semibold uppercase tracking-wide text-slate-400",
|
|
553
|
-
|
|
554
|
-
|
|
574
|
+
M(s) && "border-l border-slate-200 dark:border-border",
|
|
575
|
+
V(s),
|
|
555
576
|
a
|
|
556
577
|
),
|
|
557
578
|
children: e
|
|
558
579
|
},
|
|
559
|
-
e +
|
|
580
|
+
e + s
|
|
560
581
|
);
|
|
561
|
-
return /* @__PURE__ */ c("div", { className: "flex h-full min-h-0 flex-col", "data-record-grid-browse": !0, children: [
|
|
582
|
+
return /* @__PURE__ */ c("div", { ref: fe, className: "flex h-full min-h-0 flex-col", "data-record-grid-browse": !0, children: [
|
|
562
583
|
/* @__PURE__ */ l(
|
|
563
|
-
|
|
584
|
+
je,
|
|
564
585
|
{
|
|
565
586
|
challenge: O,
|
|
566
|
-
onCancel: () =>
|
|
587
|
+
onCancel: () => W(null),
|
|
567
588
|
onSubmit: (e) => {
|
|
568
|
-
|
|
589
|
+
W(null), L(e);
|
|
569
590
|
}
|
|
570
591
|
}
|
|
571
592
|
),
|
|
@@ -573,32 +594,32 @@ function Re({ config: t }) {
|
|
|
573
594
|
i.map((e) => /* @__PURE__ */ c("div", { className: "w-52", children: [
|
|
574
595
|
/* @__PURE__ */ l("p", { className: "mb-1 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: e.label ?? e.field }),
|
|
575
596
|
/* @__PURE__ */ l(
|
|
576
|
-
|
|
597
|
+
ye,
|
|
577
598
|
{
|
|
578
599
|
collection: e.collection,
|
|
579
600
|
value: p[e.field] ?? null,
|
|
580
|
-
onChange: (
|
|
601
|
+
onChange: (s) => ie(e.field, s),
|
|
581
602
|
placeholder: "All",
|
|
582
603
|
optionSort: e.collection === "funding_years" ? "-id" : void 0
|
|
583
604
|
}
|
|
584
605
|
)
|
|
585
606
|
] }, e.field)),
|
|
586
607
|
/* @__PURE__ */ l("span", { className: "flex-1" }),
|
|
587
|
-
|
|
588
|
-
|
|
608
|
+
J && /* @__PURE__ */ l("span", { className: "pb-2 text-[12px] text-slate-500", children: J }),
|
|
609
|
+
h && t.allow_add && /* @__PURE__ */ l(
|
|
589
610
|
"button",
|
|
590
611
|
{
|
|
591
612
|
type: "button",
|
|
592
|
-
onClick: () =>
|
|
613
|
+
onClick: () => k((e) => [...e, `new-${Date.now()}`]),
|
|
593
614
|
className: "h-9 rounded-md border border-slate-200 bg-white px-3 text-[13px] text-slate-700 hover:border-slate-400 dark:border-border dark:bg-card dark:text-slate-200",
|
|
594
615
|
children: "+ Add row"
|
|
595
616
|
}
|
|
596
617
|
),
|
|
597
|
-
|
|
618
|
+
F && /* @__PURE__ */ l(
|
|
598
619
|
"button",
|
|
599
620
|
{
|
|
600
621
|
type: "button",
|
|
601
|
-
onClick:
|
|
622
|
+
onClick: x,
|
|
602
623
|
className: "h-9 rounded-md px-3 text-[13px] font-medium text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
|
|
603
624
|
children: "Discard"
|
|
604
625
|
}
|
|
@@ -607,30 +628,44 @@ function Re({ config: t }) {
|
|
|
607
628
|
"button",
|
|
608
629
|
{
|
|
609
630
|
type: "button",
|
|
610
|
-
disabled: !
|
|
611
|
-
onClick: () => void
|
|
631
|
+
disabled: !h || !F || z,
|
|
632
|
+
onClick: () => void L(),
|
|
612
633
|
"data-record-grid-save": !0,
|
|
613
634
|
className: "inline-flex h-9 items-center gap-1.5 rounded-md bg-nvr-cyan px-3.5 text-[13px] font-semibold text-[#172940] hover:bg-nvr-cyan-dark disabled:opacity-50",
|
|
614
635
|
children: [
|
|
615
|
-
|
|
636
|
+
z && /* @__PURE__ */ l(me, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
616
637
|
"Save changes"
|
|
617
638
|
]
|
|
618
639
|
}
|
|
619
640
|
)
|
|
620
641
|
] }),
|
|
621
642
|
/* @__PURE__ */ c("div", { className: "flex shrink-0 items-center gap-2 border-b border-slate-200 bg-slate-50 px-4 py-1.5 text-[12px] text-slate-500 dark:border-border dark:bg-muted/40 dark:text-slate-400", children: [
|
|
622
|
-
|
|
643
|
+
h ? /* @__PURE__ */ c("span", { children: [
|
|
623
644
|
"Editing",
|
|
624
645
|
" ",
|
|
625
|
-
/* @__PURE__ */ l("strong", { className: "text-slate-700 dark:text-slate-200", children: i.map((e) =>
|
|
626
|
-
|
|
627
|
-
] }) :
|
|
646
|
+
/* @__PURE__ */ l("strong", { className: "text-slate-700 dark:text-slate-200", children: i.map((e) => D(e.field, p[e.field])).join(" · ") }),
|
|
647
|
+
E.length > 1 && ` — ${E.length} rows share this combination`
|
|
648
|
+
] }) : null,
|
|
649
|
+
h && re.length > 0 ? /* @__PURE__ */ l(
|
|
650
|
+
Ke,
|
|
651
|
+
{
|
|
652
|
+
className: "ml-3 border-l border-slate-200 pl-3 dark:border-border",
|
|
653
|
+
editors: re,
|
|
654
|
+
noun: ((ke = t.presence_noun) == null ? void 0 : ke.trim()) || t.collection.replace(/_/g, " ").toLowerCase(),
|
|
655
|
+
rowLabel: (e) => E.length > 1 ? `${le} (#${e})` : le || `#${e}`,
|
|
656
|
+
cellLabel: (e) => {
|
|
657
|
+
var s;
|
|
658
|
+
return (s = v.find((a) => a.field === e)) == null ? void 0 : s.label;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
) : null,
|
|
662
|
+
h ? null : /* @__PURE__ */ c("span", { children: [
|
|
628
663
|
"Totals across",
|
|
629
664
|
" ",
|
|
630
665
|
/* @__PURE__ */ l("strong", { className: "text-slate-700 dark:text-slate-200", children: j.length }),
|
|
631
666
|
" row",
|
|
632
667
|
j.length === 1 ? "" : "s",
|
|
633
|
-
w.length > 0 && /* @__PURE__ */ c(
|
|
668
|
+
w.length > 0 && /* @__PURE__ */ c(Ae, { children: [
|
|
634
669
|
", by ",
|
|
635
670
|
w.map((e) => e.label ?? e.field).join(" and "),
|
|
636
671
|
" — pick",
|
|
@@ -644,22 +679,22 @@ function Re({ config: t }) {
|
|
|
644
679
|
{
|
|
645
680
|
type: "button",
|
|
646
681
|
onClick: () => {
|
|
647
|
-
|
|
682
|
+
S({}), x();
|
|
648
683
|
},
|
|
649
684
|
className: "ml-auto inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11.5px] text-slate-500 hover:bg-slate-200/60 hover:text-slate-700 dark:hover:bg-muted",
|
|
650
685
|
children: [
|
|
651
|
-
/* @__PURE__ */ l(
|
|
686
|
+
/* @__PURE__ */ l(ve, { className: "h-3 w-3" }),
|
|
652
687
|
" Clear"
|
|
653
688
|
]
|
|
654
689
|
}
|
|
655
690
|
)
|
|
656
691
|
] }),
|
|
657
|
-
/* @__PURE__ */ l("div", { className: "min-h-0 flex-1 overflow-auto", children:
|
|
658
|
-
/* @__PURE__ */ l(
|
|
692
|
+
/* @__PURE__ */ l("div", { className: "min-h-0 flex-1 overflow-auto", children: Y ? /* @__PURE__ */ c("div", { className: "flex items-center gap-2 p-4 text-[12px] text-slate-400", children: [
|
|
693
|
+
/* @__PURE__ */ l(me, { className: "h-4 w-4 animate-spin" }),
|
|
659
694
|
" Loading…"
|
|
660
695
|
] }) : /* @__PURE__ */ c("table", { className: "w-full text-[12px]", children: [
|
|
661
696
|
/* @__PURE__ */ l("thead", { className: "sticky top-0 z-[1] bg-white dark:bg-card", children: /* @__PURE__ */ c("tr", { className: "border-b border-slate-200 dark:border-border", children: [
|
|
662
|
-
(
|
|
697
|
+
(h ? [{ field: "__row", label: "" }] : w.map((e) => ({ field: e.field, label: e.label ?? e.field }))).map((e) => /* @__PURE__ */ l(
|
|
663
698
|
"th",
|
|
664
699
|
{
|
|
665
700
|
className: "sticky left-0 z-[2] bg-white px-2 py-2 text-left text-[10.5px] font-semibold uppercase tracking-wide text-slate-400 dark:bg-card",
|
|
@@ -667,41 +702,45 @@ function Re({ config: t }) {
|
|
|
667
702
|
},
|
|
668
703
|
e.field
|
|
669
704
|
)),
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
705
|
+
v.map((e, s) => Ne(e.label, s)),
|
|
706
|
+
_ && Ne("Total", 99, "border-l border-slate-200 dark:border-border"),
|
|
707
|
+
h && t.allow_delete && /* @__PURE__ */ l("th", { "aria-label": "Remove", className: "w-8" })
|
|
673
708
|
] }) }),
|
|
674
709
|
/* @__PURE__ */ c("tbody", { children: [
|
|
675
|
-
|
|
676
|
-
var
|
|
710
|
+
h ? E.map((e) => {
|
|
711
|
+
var s;
|
|
677
712
|
return /* @__PURE__ */ c("tr", { className: "border-b border-slate-100 dark:border-border/50", children: [
|
|
678
|
-
/* @__PURE__ */ l("td", { className: "sticky left-0 z-[1] bg-white px-3 py-1 text-slate-600 dark:bg-card dark:text-slate-300", children: e.isNew ? /* @__PURE__ */ l("span", { className: "rounded bg-nvr-cyan/10 px-1.5 py-0.5 text-[10.5px] font-medium text-nvr-navy dark:text-nvr-cyan", children: "New row" }) : `#${(
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
713
|
+
/* @__PURE__ */ l("td", { className: "sticky left-0 z-[1] bg-white px-3 py-1 text-slate-600 dark:bg-card dark:text-slate-300", children: e.isNew ? /* @__PURE__ */ l("span", { className: "rounded bg-nvr-cyan/10 px-1.5 py-0.5 text-[10.5px] font-medium text-nvr-navy dark:text-nvr-cyan", children: "New row" }) : `#${(s = e.record) == null ? void 0 : s.id}` }),
|
|
714
|
+
v.map((a, d) => {
|
|
715
|
+
var u;
|
|
716
|
+
return /* @__PURE__ */ l(
|
|
717
|
+
"td",
|
|
718
|
+
{
|
|
719
|
+
"data-grid-cell": ((u = e.record) == null ? void 0 : u.id) != null ? Ve(String(e.record.id), a.field) : void 0,
|
|
720
|
+
className: X(
|
|
721
|
+
"px-1 py-0.5 text-right",
|
|
722
|
+
M(d) && "border-l border-slate-100 dark:border-border/50",
|
|
723
|
+
V(d)
|
|
724
|
+
),
|
|
725
|
+
children: /* @__PURE__ */ l(
|
|
726
|
+
Be,
|
|
727
|
+
{
|
|
728
|
+
value: r(e, a.field),
|
|
729
|
+
original: o(e, a.field),
|
|
730
|
+
onChange: (b) => n(e.key, a.field, b),
|
|
731
|
+
allowNegative: !!t.allow_negative
|
|
732
|
+
}
|
|
733
|
+
)
|
|
734
|
+
},
|
|
735
|
+
a.field
|
|
736
|
+
);
|
|
737
|
+
}),
|
|
738
|
+
_ && /* @__PURE__ */ l(
|
|
700
739
|
"td",
|
|
701
740
|
{
|
|
702
|
-
className: `border-l border-slate-200 px-2 py-1 text-right font-semibold tabular-nums dark:border-border ${
|
|
703
|
-
style:
|
|
704
|
-
children: K(
|
|
741
|
+
className: `border-l border-slate-200 px-2 py-1 text-right font-semibold tabular-nums dark:border-border ${xe}`,
|
|
742
|
+
style: Q,
|
|
743
|
+
children: K(f(e))
|
|
705
744
|
}
|
|
706
745
|
),
|
|
707
746
|
t.allow_delete && /* @__PURE__ */ l("td", { className: "py-1 pl-1", children: /* @__PURE__ */ l(
|
|
@@ -710,28 +749,28 @@ function Re({ config: t }) {
|
|
|
710
749
|
type: "button",
|
|
711
750
|
"aria-label": "Remove row",
|
|
712
751
|
onClick: () => {
|
|
713
|
-
e.record ?
|
|
752
|
+
e.record ? G((a) => {
|
|
714
753
|
var d;
|
|
715
754
|
return new Set(a).add(String((d = e.record) == null ? void 0 : d.id));
|
|
716
|
-
}) :
|
|
755
|
+
}) : k((a) => a.filter((d) => d !== e.key)), C((a) => {
|
|
717
756
|
const d = { ...a };
|
|
718
757
|
return delete d[e.key], d;
|
|
719
758
|
});
|
|
720
759
|
},
|
|
721
760
|
className: "rounded p-1 text-slate-400 hover:text-red-600",
|
|
722
|
-
children: /* @__PURE__ */ l(
|
|
761
|
+
children: /* @__PURE__ */ l(ve, { className: "h-3.5 w-3.5" })
|
|
723
762
|
}
|
|
724
763
|
) })
|
|
725
764
|
] }, e.key);
|
|
726
|
-
}) :
|
|
727
|
-
const
|
|
765
|
+
}) : ee.map((e) => {
|
|
766
|
+
const s = w.map((a) => String(e.keyVals[a.field] ?? "")).join("|");
|
|
728
767
|
return /* @__PURE__ */ c(
|
|
729
768
|
"tr",
|
|
730
769
|
{
|
|
731
770
|
className: "cursor-pointer border-b border-slate-100 hover:bg-slate-50 focus:outline-none focus-visible:bg-slate-50 dark:border-border/50 dark:hover:bg-muted/40",
|
|
732
|
-
onClick: () =>
|
|
771
|
+
onClick: () => R(e.keyVals),
|
|
733
772
|
onKeyDown: (a) => {
|
|
734
|
-
(a.key === "Enter" || a.key === " ") && (a.preventDefault(),
|
|
773
|
+
(a.key === "Enter" || a.key === " ") && (a.preventDefault(), R(e.keyVals));
|
|
735
774
|
},
|
|
736
775
|
tabIndex: 0,
|
|
737
776
|
title: "Open this combination",
|
|
@@ -744,8 +783,8 @@ function Re({ config: t }) {
|
|
|
744
783
|
d === 0 && "sticky left-0 z-[1] bg-white font-medium dark:bg-card"
|
|
745
784
|
),
|
|
746
785
|
children: [
|
|
747
|
-
d === 0 && /* @__PURE__ */ l(
|
|
748
|
-
|
|
786
|
+
d === 0 && /* @__PURE__ */ l(Me, { className: "mr-1 inline h-3 w-3 text-slate-300" }),
|
|
787
|
+
D(a.field, e.keyVals[a.field]),
|
|
749
788
|
d === w.length - 1 && e.count > 1 && /* @__PURE__ */ c("span", { className: "ml-1.5 text-[10.5px] text-slate-400", children: [
|
|
750
789
|
e.count,
|
|
751
790
|
" rows"
|
|
@@ -754,27 +793,27 @@ function Re({ config: t }) {
|
|
|
754
793
|
},
|
|
755
794
|
a.field
|
|
756
795
|
)),
|
|
757
|
-
|
|
796
|
+
v.map((a, d) => /* @__PURE__ */ l(
|
|
758
797
|
"td",
|
|
759
798
|
{
|
|
760
799
|
className: X(
|
|
761
800
|
"whitespace-nowrap px-1.5 py-1.5 text-right tabular-nums",
|
|
762
|
-
|
|
763
|
-
|
|
801
|
+
M(d) && "border-l border-slate-100 dark:border-border/50",
|
|
802
|
+
V(d),
|
|
764
803
|
(e.sums[a.field] ?? 0) === 0 ? "text-slate-300 dark:text-slate-600" : "text-slate-700 dark:text-slate-200"
|
|
765
804
|
),
|
|
766
805
|
children: K(e.sums[a.field], { blankZero: !0 })
|
|
767
806
|
},
|
|
768
807
|
a.field
|
|
769
808
|
)),
|
|
770
|
-
|
|
809
|
+
_ && /* @__PURE__ */ l(
|
|
771
810
|
"td",
|
|
772
811
|
{
|
|
773
|
-
className: `border-l border-slate-200 px-2 py-1.5 text-right font-semibold tabular-nums dark:border-border ${
|
|
774
|
-
style:
|
|
812
|
+
className: `border-l border-slate-200 px-2 py-1.5 text-right font-semibold tabular-nums dark:border-border ${xe}`,
|
|
813
|
+
style: Q,
|
|
775
814
|
children: K(
|
|
776
|
-
|
|
777
|
-
(a, d) => a + (e.sums[`${d}${
|
|
815
|
+
U.reduce(
|
|
816
|
+
(a, d) => a + (e.sums[`${d}${_.suffix}`] ?? 0),
|
|
778
817
|
0
|
|
779
818
|
)
|
|
780
819
|
)
|
|
@@ -782,48 +821,48 @@ function Re({ config: t }) {
|
|
|
782
821
|
)
|
|
783
822
|
]
|
|
784
823
|
},
|
|
785
|
-
|
|
824
|
+
s
|
|
786
825
|
);
|
|
787
826
|
}),
|
|
788
|
-
!
|
|
827
|
+
!h && ee.length === 0 && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", { colSpan: 99, className: "py-6 text-center text-[12px] text-slate-400", children: "No rows match" }) })
|
|
789
828
|
] }),
|
|
790
829
|
/* @__PURE__ */ l("tfoot", { className: "sticky bottom-0 bg-white dark:bg-card", children: /* @__PURE__ */ c("tr", { className: "border-t-2 border-slate-300 dark:border-border", children: [
|
|
791
830
|
/* @__PURE__ */ l(
|
|
792
831
|
"td",
|
|
793
832
|
{
|
|
794
|
-
colSpan:
|
|
833
|
+
colSpan: h ? 1 : Math.max(1, w.length),
|
|
795
834
|
className: "sticky left-0 z-[1] bg-white px-3 py-2 text-[12px] font-semibold text-slate-800 dark:bg-card dark:text-slate-100",
|
|
796
835
|
children: "Total"
|
|
797
836
|
}
|
|
798
837
|
),
|
|
799
|
-
|
|
838
|
+
v.map((e, s) => /* @__PURE__ */ l(
|
|
800
839
|
"td",
|
|
801
840
|
{
|
|
802
841
|
className: X(
|
|
803
842
|
"px-2 py-2 text-right font-semibold tabular-nums text-slate-800 dark:text-slate-100",
|
|
804
|
-
|
|
805
|
-
|
|
843
|
+
M(s) && "border-l border-slate-200 dark:border-border",
|
|
844
|
+
V(s)
|
|
806
845
|
),
|
|
807
|
-
children: K(
|
|
846
|
+
children: K(A(e.field))
|
|
808
847
|
},
|
|
809
848
|
e.field
|
|
810
849
|
)),
|
|
811
|
-
|
|
850
|
+
_ && /* @__PURE__ */ l(
|
|
812
851
|
"td",
|
|
813
852
|
{
|
|
814
|
-
className: `border-l border-slate-200 px-2 py-2 text-right font-semibold tabular-nums dark:border-border ${
|
|
815
|
-
style:
|
|
816
|
-
children: K(
|
|
853
|
+
className: `border-l border-slate-200 px-2 py-2 text-right font-semibold tabular-nums dark:border-border ${xe}`,
|
|
854
|
+
style: Q,
|
|
855
|
+
children: K(U.reduce((e, s) => e + A(`${s}${_.suffix}`), 0))
|
|
817
856
|
}
|
|
818
857
|
),
|
|
819
|
-
|
|
858
|
+
h && t.allow_delete && /* @__PURE__ */ l("td", {})
|
|
820
859
|
] }) })
|
|
821
860
|
] }) })
|
|
822
861
|
] });
|
|
823
862
|
}
|
|
824
863
|
export {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
864
|
+
Ee as NEGATIVE_AMOUNT_MESSAGE,
|
|
865
|
+
Be as NumberCell,
|
|
866
|
+
ut as RecordGridEditor,
|
|
867
|
+
We as sanitizeAmount
|
|
829
868
|
};
|