@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,233 +1,363 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { Loader2 as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { jsx as l, jsxs as v, Fragment as re } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as ie } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as oe, Check as G, Pencil as ae, AlertTriangle as se } from "lucide-react";
|
|
4
|
+
import { useState as E, useRef as T, useEffect as K, useCallback as $ } from "react";
|
|
5
|
+
import { useNivaroClient as X } from "../../context.js";
|
|
6
|
+
import { releaseCell as V, readCellHolders as le, CELL_READ_COALESCE_MS as ce, takeCell as Y, CELL_BEAT_MS as ue, cellHolderKey as de, overwritesOthers as me } from "../../lib/cell-locks.js";
|
|
7
|
+
import { patch as fe, get as H } from "../../lib/commands.js";
|
|
8
|
+
import { cursorColor as pe } from "../../lib/grid-cursors.js";
|
|
9
|
+
import { inlineValueUnchanged as he, inlineInputValue as xe, parseInlineInput as z } from "../../lib/list-inline-edit.js";
|
|
10
|
+
import { useLiveCollection as ge, LIVE_ASPECTS as be } from "../../lib/live.js";
|
|
11
|
+
import { userErrorMessage as ve } from "../../lib/safe-error.js";
|
|
12
|
+
import { choiceLabel as Z, cn as q, formatDate as we } from "../../lib/utils.js";
|
|
13
|
+
import { RelationCombobox as ye } from "../item-edit/RelationCombobox.js";
|
|
14
|
+
import { RelationLabel as Ce } from "../layout-editor/pickers/relation-label.js";
|
|
15
|
+
import { Command as Ne, CommandInput as ke, CommandList as Se, CommandEmpty as Ee, CommandItem as W } from "../ui/command.js";
|
|
16
|
+
import { Popover as Te, PopoverAnchor as Oe, PopoverContent as Pe } from "../ui/popover.js";
|
|
17
|
+
function Ze() {
|
|
18
|
+
const t = X(), [n, i] = E(null), [c, s] = E({}), [m, o] = E({}), [f, y] = E({}), [a, x] = E({}), [O, I] = E({}), [k, p] = E(() => /* @__PURE__ */ new Map()), [N, b] = E([]), A = T({}), P = T(/* @__PURE__ */ new Map()), S = T(/* @__PURE__ */ new Map()), C = T(null), _ = T(/* @__PURE__ */ new Map()), L = T(!0);
|
|
19
|
+
K(() => {
|
|
20
|
+
L.current = !0;
|
|
21
|
+
const e = _.current;
|
|
22
|
+
return () => {
|
|
23
|
+
L.current = !1;
|
|
24
|
+
for (const r of Object.values(A.current)) clearTimeout(r);
|
|
25
|
+
for (const r of e.values()) clearTimeout(r);
|
|
26
|
+
e.clear(), C.current && V(t, C.current.coords), C.current = null;
|
|
27
|
+
};
|
|
28
|
+
}, [t]);
|
|
29
|
+
const h = $(
|
|
30
|
+
(e) => {
|
|
31
|
+
_.current.has(e) || _.current.set(
|
|
32
|
+
e,
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
var u;
|
|
35
|
+
_.current.delete(e);
|
|
36
|
+
const r = [...((u = P.current.get(e)) == null ? void 0 : u.values()) ?? []];
|
|
37
|
+
le(t, e, r).then((d) => {
|
|
38
|
+
L.current && p((g) => {
|
|
39
|
+
const w = new Map(g);
|
|
40
|
+
for (const j of w.keys()) j.startsWith(`${e}`) && w.delete(j);
|
|
41
|
+
for (const [j, ne] of d) w.set(j, ne);
|
|
42
|
+
return w;
|
|
43
|
+
});
|
|
44
|
+
}).catch(() => {
|
|
45
|
+
});
|
|
46
|
+
}, ce)
|
|
47
|
+
);
|
|
18
48
|
},
|
|
19
|
-
[]
|
|
49
|
+
[t]
|
|
50
|
+
), F = $(
|
|
51
|
+
(e, r) => {
|
|
52
|
+
let u = P.current.get(r.collection);
|
|
53
|
+
if (!u) {
|
|
54
|
+
u = /* @__PURE__ */ new Map(), P.current.set(r.collection, u);
|
|
55
|
+
const d = r.collection;
|
|
56
|
+
b((g) => g.includes(d) ? g : [...g, d]);
|
|
57
|
+
}
|
|
58
|
+
return u.set(e, r), h(r.collection), () => {
|
|
59
|
+
var d;
|
|
60
|
+
(d = P.current.get(r.collection)) == null || d.delete(e);
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
[h]
|
|
20
64
|
);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
65
|
+
ge(
|
|
66
|
+
N,
|
|
67
|
+
(e) => {
|
|
68
|
+
const r = new Set(e.events.map((u) => String(u.collection)));
|
|
69
|
+
for (const u of r) h(u);
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
debounceMs: 300,
|
|
73
|
+
match: (e) => {
|
|
74
|
+
var g;
|
|
75
|
+
const r = P.current.get(String(e.collection));
|
|
76
|
+
if (!r || r.size === 0 || !!!((g = e.changed_fields) != null && g.includes(be.cells)) && e.action !== "delete") return !1;
|
|
77
|
+
if (e.item === "*") return !0;
|
|
78
|
+
const d = String(e.item).toUpperCase();
|
|
79
|
+
for (const w of r.values()) if (String(w.id).toUpperCase() === d) return !0;
|
|
80
|
+
return !1;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
), K(() => {
|
|
84
|
+
const e = C.current;
|
|
85
|
+
if (e && e.cellKey !== n && (V(t, e.coords), C.current = null), !n || !C.current) return;
|
|
86
|
+
const r = C.current.coords, u = setInterval(() => void Y(t, r, !0), ue);
|
|
87
|
+
return () => clearInterval(u);
|
|
88
|
+
}, [n, t]);
|
|
89
|
+
const M = $((e) => {
|
|
90
|
+
s((r) => {
|
|
91
|
+
if (!(e in r)) return r;
|
|
92
|
+
const u = { ...r };
|
|
25
93
|
return delete u[e], u;
|
|
26
94
|
});
|
|
27
|
-
}, []),
|
|
28
|
-
(e) => {
|
|
29
|
-
|
|
95
|
+
}, []), D = $(
|
|
96
|
+
(e, r) => {
|
|
97
|
+
M(e), I((d) => R(d, e)), x((d) => R(d, e)), i(e);
|
|
98
|
+
const u = r == null ? void 0 : r.coords;
|
|
99
|
+
u && (S.current.set(e, { value: r == null ? void 0 : r.value, at: (/* @__PURE__ */ new Date()).toISOString() }), C.current = { cellKey: e, coords: u }, Y(t, u).then((d) => {
|
|
100
|
+
var g;
|
|
101
|
+
d.ok || !L.current || (((g = C.current) == null ? void 0 : g.cellKey) === e && (C.current = null), S.current.delete(e), i((w) => w === e ? null : w), I((w) => ({ ...w, [e]: d.holder.name })), h(u.collection));
|
|
102
|
+
}));
|
|
30
103
|
},
|
|
31
|
-
[
|
|
32
|
-
),
|
|
104
|
+
[M, t, h]
|
|
105
|
+
), B = $(() => i(null), []), U = $(
|
|
33
106
|
(e) => {
|
|
34
107
|
var u;
|
|
35
|
-
|
|
36
|
-
const f = ((u = e.optimistic) == null ? void 0 : u.call(e)) ?? (() => {
|
|
108
|
+
const r = ((u = e.optimistic) == null ? void 0 : u.call(e)) ?? (() => {
|
|
37
109
|
});
|
|
38
|
-
|
|
39
|
-
|
|
110
|
+
o((d) => ({ ...d, [e.cellKey]: !0 })), t.request(
|
|
111
|
+
fe(`/items/${encodeURIComponent(e.collection)}/${encodeURIComponent(String(e.id))}`, {
|
|
40
112
|
[e.field]: e.value
|
|
41
113
|
})
|
|
42
|
-
).then((
|
|
114
|
+
).then((d) => {
|
|
43
115
|
var g;
|
|
44
|
-
(g = e.onSaved) == null || g.call(e, (
|
|
45
|
-
|
|
46
|
-
const S = { ...E };
|
|
47
|
-
return delete S[e.cellKey], S;
|
|
48
|
-
});
|
|
116
|
+
(g = e.onSaved) == null || g.call(e, (d == null ? void 0 : d.data) ?? null), y((w) => ({ ...w, [e.cellKey]: !0 })), clearTimeout(A.current[e.cellKey]), A.current[e.cellKey] = setTimeout(() => {
|
|
117
|
+
y((w) => R(w, e.cellKey));
|
|
49
118
|
}, 1500);
|
|
50
|
-
}).catch((
|
|
51
|
-
|
|
119
|
+
}).catch((d) => {
|
|
120
|
+
r(), s((g) => ({
|
|
52
121
|
...g,
|
|
53
|
-
[e.cellKey]:
|
|
122
|
+
[e.cellKey]: ve(d, "This change was not saved")
|
|
54
123
|
}));
|
|
55
124
|
}).finally(() => {
|
|
56
|
-
|
|
57
|
-
const g = { ...x };
|
|
58
|
-
return delete g[e.cellKey], g;
|
|
59
|
-
});
|
|
125
|
+
o((d) => R(d, e.cellKey));
|
|
60
126
|
});
|
|
61
127
|
},
|
|
62
|
-
[t
|
|
128
|
+
[t]
|
|
129
|
+
), ee = $(
|
|
130
|
+
(e) => {
|
|
131
|
+
i(e.next ?? null);
|
|
132
|
+
const r = S.current.get(e.cellKey);
|
|
133
|
+
if (S.current.delete(e.cellKey), !he(e.kind, e.before, e.value)) {
|
|
134
|
+
if (M(e.cellKey), !r) {
|
|
135
|
+
U(e);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
o((u) => ({ ...u, [e.cellKey]: !0 })), Le(t, e, r).catch(() => null).then((u) => {
|
|
139
|
+
if (L.current) {
|
|
140
|
+
if (!u) {
|
|
141
|
+
U(e);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
o((d) => R(d, e.cellKey)), x((d) => ({ ...d, [e.cellKey]: u }));
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
[t, M, U]
|
|
150
|
+
), te = $(
|
|
151
|
+
(e, r) => {
|
|
152
|
+
var d, g;
|
|
153
|
+
const u = a[e];
|
|
154
|
+
u && (x((w) => R(w, e)), r === "mine" ? U(u.commit) : (g = (d = u.commit).onSaved) == null || g.call(d, null));
|
|
155
|
+
},
|
|
156
|
+
[a, U]
|
|
63
157
|
);
|
|
64
158
|
return {
|
|
65
|
-
editing:
|
|
66
|
-
start:
|
|
67
|
-
cancel:
|
|
68
|
-
commit:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
159
|
+
editing: n,
|
|
160
|
+
start: D,
|
|
161
|
+
cancel: B,
|
|
162
|
+
commit: ee,
|
|
163
|
+
watchCell: F,
|
|
164
|
+
holderOf: (e) => {
|
|
165
|
+
const r = k.get(de(e.collection, e.id, e.field));
|
|
166
|
+
return r && !r.mine ? r : null;
|
|
167
|
+
},
|
|
168
|
+
refusedOf: (e) => O[e] ?? null,
|
|
169
|
+
conflictOf: (e) => a[e] ?? null,
|
|
170
|
+
resolveConflict: te,
|
|
171
|
+
errorOf: (e) => c[e] ?? null,
|
|
172
|
+
savingOf: (e) => !!m[e],
|
|
173
|
+
savedOf: (e) => !!f[e],
|
|
174
|
+
clearError: M
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function R(t, n) {
|
|
178
|
+
if (!(n in t)) return t;
|
|
179
|
+
const i = { ...t };
|
|
180
|
+
return delete i[n], i;
|
|
181
|
+
}
|
|
182
|
+
async function Le(t, n, i) {
|
|
183
|
+
var a;
|
|
184
|
+
const c = `/items/${encodeURIComponent(n.collection)}/${encodeURIComponent(String(n.id))}`, s = await t.request(
|
|
185
|
+
H(c, { fields: `id,${n.field}` })
|
|
186
|
+
), m = s == null ? void 0 : s.data;
|
|
187
|
+
if (!m || !(n.field in m)) return null;
|
|
188
|
+
const o = m[n.field];
|
|
189
|
+
if (!me(n.kind, i.value, o, n.value)) return null;
|
|
190
|
+
const f = await t.request(
|
|
191
|
+
H("/picker-exclusions/linked-change", {
|
|
192
|
+
collection: n.collection,
|
|
193
|
+
item_id: String(n.id),
|
|
194
|
+
since: i.at
|
|
195
|
+
})
|
|
196
|
+
).then((x) => (x == null ? void 0 : x.data) ?? null).catch(() => null), y = !!((a = f == null ? void 0 : f.fields) != null && a.some((x) => x.field === n.field));
|
|
197
|
+
return {
|
|
198
|
+
theirs: o,
|
|
199
|
+
mine: n.value,
|
|
200
|
+
by: y ? (f == null ? void 0 : f.by) ?? null : null,
|
|
201
|
+
at: y ? (f == null ? void 0 : f.at) ?? null : null,
|
|
202
|
+
commit: n
|
|
73
203
|
};
|
|
74
204
|
}
|
|
75
|
-
function
|
|
76
|
-
const
|
|
205
|
+
function De(t) {
|
|
206
|
+
const n = X(), { data: i } = ie({
|
|
77
207
|
queryKey: ["cbv-collection-meta", t],
|
|
78
|
-
queryFn: () =>
|
|
208
|
+
queryFn: () => n.request(H(`/collections/${t}`)).then((s) => s.data),
|
|
79
209
|
enabled: !!t,
|
|
80
210
|
staleTime: 10 * 6e4,
|
|
81
211
|
retry: !1
|
|
82
|
-
}),
|
|
83
|
-
if (
|
|
84
|
-
if (typeof
|
|
85
|
-
if (typeof
|
|
212
|
+
}), c = i == null ? void 0 : i.picker_filter;
|
|
213
|
+
if (c) {
|
|
214
|
+
if (typeof c == "object" && !Array.isArray(c)) return c;
|
|
215
|
+
if (typeof c == "string")
|
|
86
216
|
try {
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
return
|
|
217
|
+
const s = JSON.parse(c);
|
|
218
|
+
if (s && typeof s == "object" && !Array.isArray(s))
|
|
219
|
+
return s;
|
|
90
220
|
} catch {
|
|
91
221
|
}
|
|
92
222
|
}
|
|
93
223
|
}
|
|
94
|
-
const
|
|
95
|
-
function
|
|
224
|
+
const J = "h-7 w-full min-w-[120px] rounded border border-nvr-cyan bg-white px-1.5 text-[12px] text-slate-800 shadow-sm outline-none ring-2 ring-nvr-cyan/30 dark:bg-slate-900 dark:text-slate-100";
|
|
225
|
+
function $e({
|
|
96
226
|
kind: t,
|
|
97
|
-
value:
|
|
98
|
-
label:
|
|
99
|
-
onCommit:
|
|
100
|
-
onCancel:
|
|
227
|
+
value: n,
|
|
228
|
+
label: i,
|
|
229
|
+
onCommit: c,
|
|
230
|
+
onCancel: s
|
|
101
231
|
}) {
|
|
102
|
-
const [
|
|
103
|
-
|
|
104
|
-
var
|
|
105
|
-
(
|
|
232
|
+
const [m, o] = E(() => xe(t, n)), [f, y] = E(null), a = T(!1), x = T(null);
|
|
233
|
+
K(() => {
|
|
234
|
+
var p, N, b;
|
|
235
|
+
(p = x.current) == null || p.focus();
|
|
106
236
|
try {
|
|
107
|
-
(
|
|
237
|
+
(b = (N = x.current) == null ? void 0 : N.select) == null || b.call(N);
|
|
108
238
|
} catch {
|
|
109
239
|
}
|
|
110
240
|
}, []);
|
|
111
|
-
const
|
|
112
|
-
var
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
116
|
-
|
|
241
|
+
const O = (p) => {
|
|
242
|
+
var b;
|
|
243
|
+
if (a.current) return;
|
|
244
|
+
const N = z(t, m);
|
|
245
|
+
if (!N.ok) {
|
|
246
|
+
y(N.error), (b = x.current) == null || b.focus();
|
|
117
247
|
return;
|
|
118
248
|
}
|
|
119
|
-
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
"aria-label": `Edit ${
|
|
124
|
-
"aria-invalid":
|
|
125
|
-
value:
|
|
126
|
-
onChange: (
|
|
127
|
-
|
|
249
|
+
a.current = !0, c(N.value, p);
|
|
250
|
+
}, I = (p) => {
|
|
251
|
+
p.stopPropagation(), p.key === "Escape" ? (p.preventDefault(), a.current = !0, s()) : p.key === "Enter" && !(t === "longtext" && p.shiftKey) ? (p.preventDefault(), O(0)) : p.key === "Tab" && (p.preventDefault(), O(p.shiftKey ? -1 : 1));
|
|
252
|
+
}, k = {
|
|
253
|
+
"aria-label": `Edit ${i}`,
|
|
254
|
+
"aria-invalid": f ? !0 : void 0,
|
|
255
|
+
value: m,
|
|
256
|
+
onChange: (p) => {
|
|
257
|
+
o(p.target.value), f && y(null);
|
|
128
258
|
},
|
|
129
|
-
onKeyDown:
|
|
259
|
+
onKeyDown: I,
|
|
130
260
|
// Clicking away keeps what was typed (a spreadsheet's habit); a value that
|
|
131
261
|
// does not parse is dropped (Enter / Tab say why instead).
|
|
132
262
|
onBlur: () => {
|
|
133
|
-
if (!
|
|
134
|
-
if (!
|
|
135
|
-
|
|
263
|
+
if (!a.current) {
|
|
264
|
+
if (!z(t, m).ok) {
|
|
265
|
+
a.current = !0, s();
|
|
136
266
|
return;
|
|
137
267
|
}
|
|
138
|
-
|
|
268
|
+
O(0);
|
|
139
269
|
}
|
|
140
270
|
},
|
|
141
|
-
onClick: (
|
|
142
|
-
onDoubleClick: (
|
|
271
|
+
onClick: (p) => p.stopPropagation(),
|
|
272
|
+
onDoubleClick: (p) => p.stopPropagation()
|
|
143
273
|
};
|
|
144
274
|
return /* @__PURE__ */ v("span", { className: "block min-w-0", "data-inline-editor": t, children: [
|
|
145
|
-
t === "longtext" ? /* @__PURE__ */
|
|
275
|
+
t === "longtext" ? /* @__PURE__ */ l(
|
|
146
276
|
"textarea",
|
|
147
277
|
{
|
|
148
|
-
ref:
|
|
278
|
+
ref: x,
|
|
149
279
|
rows: 2,
|
|
150
|
-
...
|
|
151
|
-
className:
|
|
280
|
+
...k,
|
|
281
|
+
className: q(J, "h-auto min-h-[28px] resize-y py-1")
|
|
152
282
|
}
|
|
153
|
-
) : /* @__PURE__ */
|
|
283
|
+
) : /* @__PURE__ */ l(
|
|
154
284
|
"input",
|
|
155
285
|
{
|
|
156
|
-
ref:
|
|
286
|
+
ref: x,
|
|
157
287
|
type: t === "date" ? "date" : t === "datetime" ? "datetime-local" : "text",
|
|
158
288
|
inputMode: t === "integer" ? "numeric" : t === "number" ? "decimal" : void 0,
|
|
159
|
-
...
|
|
160
|
-
className:
|
|
161
|
-
|
|
289
|
+
...k,
|
|
290
|
+
className: q(
|
|
291
|
+
J,
|
|
162
292
|
(t === "integer" || t === "number") && "text-right tabular-nums"
|
|
163
293
|
)
|
|
164
294
|
}
|
|
165
295
|
),
|
|
166
|
-
|
|
296
|
+
f && /* @__PURE__ */ l("span", { className: "mt-0.5 block text-[10.5px] font-medium text-red-600 dark:text-red-400", children: f })
|
|
167
297
|
] });
|
|
168
298
|
}
|
|
169
|
-
function
|
|
299
|
+
function Ie({
|
|
170
300
|
value: t,
|
|
171
|
-
options:
|
|
172
|
-
label:
|
|
173
|
-
onCommit:
|
|
174
|
-
onCancel:
|
|
301
|
+
options: n,
|
|
302
|
+
label: i,
|
|
303
|
+
onCommit: c,
|
|
304
|
+
onCancel: s
|
|
175
305
|
}) {
|
|
176
|
-
var
|
|
177
|
-
const
|
|
178
|
-
|
|
306
|
+
var y;
|
|
307
|
+
const m = T(!1), o = t == null ? "" : String(t), f = (a, x = 0) => {
|
|
308
|
+
m.current || (m.current = !0, c(a === "" ? null : a, x));
|
|
179
309
|
};
|
|
180
310
|
return /* @__PURE__ */ v(
|
|
181
|
-
|
|
311
|
+
Te,
|
|
182
312
|
{
|
|
183
313
|
open: !0,
|
|
184
|
-
onOpenChange: (
|
|
185
|
-
!
|
|
314
|
+
onOpenChange: (a) => {
|
|
315
|
+
!a && !m.current && (m.current = !0, s());
|
|
186
316
|
},
|
|
187
317
|
children: [
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
|
|
318
|
+
/* @__PURE__ */ l(Oe, { asChild: !0, children: /* @__PURE__ */ l("span", { className: "block h-7 min-w-[120px] rounded border border-nvr-cyan bg-white px-1.5 py-1 text-[12px] text-slate-700 ring-2 ring-nvr-cyan/30 dark:bg-slate-900 dark:text-slate-200", children: ((y = n.find((a) => a.value === o)) == null ? void 0 : y.label) ?? (o || "—") }) }),
|
|
319
|
+
/* @__PURE__ */ l(
|
|
320
|
+
Pe,
|
|
191
321
|
{
|
|
192
322
|
align: "start",
|
|
193
323
|
className: "w-[240px] p-0",
|
|
194
|
-
onClick: (
|
|
195
|
-
onKeyDown: (
|
|
196
|
-
|
|
324
|
+
onClick: (a) => a.stopPropagation(),
|
|
325
|
+
onKeyDown: (a) => {
|
|
326
|
+
a.stopPropagation(), a.key === "Tab" && (a.preventDefault(), f(o, a.shiftKey ? -1 : 1));
|
|
197
327
|
},
|
|
198
|
-
children: /* @__PURE__ */ v(
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
/* @__PURE__ */ v(
|
|
201
|
-
/* @__PURE__ */
|
|
328
|
+
children: /* @__PURE__ */ v(Ne, { children: [
|
|
329
|
+
/* @__PURE__ */ l(ke, { placeholder: `Set ${i}…`, className: "h-8 text-[12px]" }),
|
|
330
|
+
/* @__PURE__ */ v(Se, { children: [
|
|
331
|
+
/* @__PURE__ */ l(Ee, { className: "py-3 text-center text-[12px] text-muted-foreground", children: "No matches" }),
|
|
202
332
|
/* @__PURE__ */ v(
|
|
203
|
-
|
|
333
|
+
W,
|
|
204
334
|
{
|
|
205
335
|
value: "__clear__ —",
|
|
206
|
-
onSelect: () =>
|
|
336
|
+
onSelect: () => f(""),
|
|
207
337
|
className: "text-[12px] text-slate-500 dark:text-slate-400",
|
|
208
338
|
children: [
|
|
209
|
-
/* @__PURE__ */
|
|
339
|
+
/* @__PURE__ */ l("span", { className: "mr-2 inline-block w-3" }),
|
|
210
340
|
"— Clear —"
|
|
211
341
|
]
|
|
212
342
|
}
|
|
213
343
|
),
|
|
214
|
-
|
|
215
|
-
|
|
344
|
+
n.map((a) => /* @__PURE__ */ v(
|
|
345
|
+
W,
|
|
216
346
|
{
|
|
217
|
-
value: `${
|
|
218
|
-
onSelect: () =>
|
|
347
|
+
value: `${a.label} ${a.value}`,
|
|
348
|
+
onSelect: () => f(a.value),
|
|
219
349
|
className: "text-[12px]",
|
|
220
350
|
children: [
|
|
221
|
-
/* @__PURE__ */
|
|
222
|
-
|
|
351
|
+
/* @__PURE__ */ l(
|
|
352
|
+
G,
|
|
223
353
|
{
|
|
224
|
-
className:
|
|
354
|
+
className: q("mr-2 h-3 w-3", a.value === o ? "opacity-100" : "opacity-0")
|
|
225
355
|
}
|
|
226
356
|
),
|
|
227
|
-
|
|
357
|
+
a.label
|
|
228
358
|
]
|
|
229
359
|
},
|
|
230
|
-
|
|
360
|
+
a.value
|
|
231
361
|
))
|
|
232
362
|
] })
|
|
233
363
|
] })
|
|
@@ -237,84 +367,238 @@ function X({
|
|
|
237
367
|
}
|
|
238
368
|
);
|
|
239
369
|
}
|
|
240
|
-
function
|
|
370
|
+
function _e({
|
|
241
371
|
target: t,
|
|
242
|
-
value:
|
|
243
|
-
onCommit:
|
|
244
|
-
onCancel:
|
|
372
|
+
value: n,
|
|
373
|
+
onCommit: i,
|
|
374
|
+
onCancel: c
|
|
245
375
|
}) {
|
|
246
|
-
const
|
|
247
|
-
return
|
|
248
|
-
const
|
|
249
|
-
|
|
376
|
+
const s = De(t), m = T(!1);
|
|
377
|
+
return K(() => {
|
|
378
|
+
const o = (f) => {
|
|
379
|
+
f.key !== "Escape" || m.current || (m.current = !0, c());
|
|
250
380
|
};
|
|
251
|
-
return document.addEventListener("keydown",
|
|
252
|
-
}, [
|
|
253
|
-
/* @__PURE__ */
|
|
381
|
+
return document.addEventListener("keydown", o, !0), () => document.removeEventListener("keydown", o, !0);
|
|
382
|
+
}, [c]), // biome-ignore lint/a11y/noStaticElementInteractions: stops the row's open-on-click
|
|
383
|
+
/* @__PURE__ */ l(
|
|
254
384
|
"span",
|
|
255
385
|
{
|
|
256
386
|
className: "block min-w-[180px]",
|
|
257
|
-
onClick: (
|
|
258
|
-
onKeyDown: (
|
|
387
|
+
onClick: (o) => o.stopPropagation(),
|
|
388
|
+
onKeyDown: (o) => o.stopPropagation(),
|
|
259
389
|
"data-inline-editor": "m2o",
|
|
260
|
-
children: /* @__PURE__ */
|
|
261
|
-
|
|
390
|
+
children: /* @__PURE__ */ l(
|
|
391
|
+
ye,
|
|
262
392
|
{
|
|
263
393
|
collection: t,
|
|
264
|
-
value:
|
|
394
|
+
value: n,
|
|
265
395
|
defaultOpen: !0,
|
|
266
|
-
extraFilter:
|
|
267
|
-
onChange: (
|
|
268
|
-
|
|
396
|
+
extraFilter: s,
|
|
397
|
+
onChange: (o) => {
|
|
398
|
+
m.current || (m.current = !0, i(o ?? null, 0));
|
|
269
399
|
},
|
|
270
400
|
onClose: () => {
|
|
271
|
-
|
|
401
|
+
m.current || (m.current = !0, c());
|
|
272
402
|
}
|
|
273
403
|
}
|
|
274
404
|
)
|
|
275
405
|
}
|
|
276
406
|
);
|
|
277
407
|
}
|
|
278
|
-
function
|
|
279
|
-
|
|
280
|
-
cellKey: p,
|
|
281
|
-
kind: o,
|
|
408
|
+
function Q({
|
|
409
|
+
kind: t,
|
|
282
410
|
value: n,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
children:
|
|
411
|
+
choices: i,
|
|
412
|
+
target: c
|
|
413
|
+
}) {
|
|
414
|
+
var m;
|
|
415
|
+
if (n == null || n === "") return /* @__PURE__ */ l("span", { className: "italic", children: "empty" });
|
|
416
|
+
if (t === "m2o" && c) {
|
|
417
|
+
const o = n && typeof n == "object" ? n.id : n;
|
|
418
|
+
return /* @__PURE__ */ l(Ce, { relatedCollection: c, id: o });
|
|
419
|
+
}
|
|
420
|
+
let s;
|
|
421
|
+
if (t === "boolean") s = n === !0 || n === 1 || n === "true" ? "Yes" : "No";
|
|
422
|
+
else if (t === "choice")
|
|
423
|
+
s = Z(((m = i == null ? void 0 : i.find((o) => o.value === String(n))) == null ? void 0 : m.label) ?? String(n));
|
|
424
|
+
else if (t === "date") s = we(String(n));
|
|
425
|
+
else if (t === "datetime") {
|
|
426
|
+
const o = new Date(String(n));
|
|
427
|
+
s = Number.isNaN(o.getTime()) ? String(n) : o.toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
|
|
428
|
+
} else s = String(n);
|
|
429
|
+
return /* @__PURE__ */ v("span", { children: [
|
|
430
|
+
"“",
|
|
431
|
+
s,
|
|
432
|
+
"”"
|
|
433
|
+
] });
|
|
434
|
+
}
|
|
435
|
+
function Me(t) {
|
|
436
|
+
if (!t) return null;
|
|
437
|
+
const n = new Date(t);
|
|
438
|
+
return Number.isNaN(n.getTime()) ? null : n.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
|
|
439
|
+
}
|
|
440
|
+
function Re({
|
|
441
|
+
conflict: t,
|
|
442
|
+
kind: n,
|
|
443
|
+
choices: i,
|
|
444
|
+
target: c,
|
|
445
|
+
onKeep: s
|
|
446
|
+
}) {
|
|
447
|
+
const m = Me(t.at);
|
|
448
|
+
return (
|
|
449
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: stops the row's open-on-click
|
|
450
|
+
// biome-ignore lint/a11y/useKeyWithClickEvents: the two buttons inside take the keys
|
|
451
|
+
/* @__PURE__ */ v(
|
|
452
|
+
"span",
|
|
453
|
+
{
|
|
454
|
+
"data-inline-conflict": "",
|
|
455
|
+
onClick: (o) => o.stopPropagation(),
|
|
456
|
+
className: "flex min-w-[240px] max-w-[560px] flex-wrap items-center gap-x-3 gap-y-1 whitespace-normal rounded-md bg-amber-50 px-2 py-1 text-[11.5px] leading-4 text-amber-900 ring-1 ring-inset ring-amber-200 dark:bg-amber-400/10 dark:text-amber-100 dark:ring-amber-400/25",
|
|
457
|
+
children: [
|
|
458
|
+
/* @__PURE__ */ v("span", { className: "flex min-w-0 flex-1 basis-[240px] items-start gap-1.5", children: [
|
|
459
|
+
/* @__PURE__ */ l(
|
|
460
|
+
se,
|
|
461
|
+
{
|
|
462
|
+
"aria-hidden": "true",
|
|
463
|
+
className: "mt-0.5 h-3 w-3 shrink-0 text-amber-600 dark:text-amber-300"
|
|
464
|
+
}
|
|
465
|
+
),
|
|
466
|
+
/* @__PURE__ */ v("span", { className: "min-w-0", children: [
|
|
467
|
+
t.by ?? "Someone",
|
|
468
|
+
" changed this to",
|
|
469
|
+
" ",
|
|
470
|
+
/* @__PURE__ */ l("span", { className: "font-medium", children: /* @__PURE__ */ l(Q, { kind: n, value: t.theirs, choices: i, target: c }) }),
|
|
471
|
+
m ? /* @__PURE__ */ v(re, { children: [
|
|
472
|
+
" ",
|
|
473
|
+
/* @__PURE__ */ v("span", { className: "whitespace-nowrap", children: [
|
|
474
|
+
"at ",
|
|
475
|
+
m
|
|
476
|
+
] })
|
|
477
|
+
] }) : " while you were editing",
|
|
478
|
+
". ",
|
|
479
|
+
/* @__PURE__ */ l("span", { className: "whitespace-nowrap", children: "Yours:" }),
|
|
480
|
+
" ",
|
|
481
|
+
/* @__PURE__ */ l("span", { className: "font-medium", "data-inline-conflict-mine": "", children: /* @__PURE__ */ l(Q, { kind: n, value: t.mine, choices: i, target: c }) })
|
|
482
|
+
] })
|
|
483
|
+
] }),
|
|
484
|
+
/* @__PURE__ */ v("span", { className: "ml-auto flex shrink-0 items-center gap-1", children: [
|
|
485
|
+
/* @__PURE__ */ l(
|
|
486
|
+
"button",
|
|
487
|
+
{
|
|
488
|
+
type: "button",
|
|
489
|
+
onClick: () => s("mine"),
|
|
490
|
+
className: "rounded px-1.5 py-0.5 font-medium text-amber-900 ring-1 ring-inset ring-amber-300 transition-colors hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-amber-50 dark:ring-amber-400/40 dark:hover:bg-amber-400/15",
|
|
491
|
+
children: "Keep mine"
|
|
492
|
+
}
|
|
493
|
+
),
|
|
494
|
+
/* @__PURE__ */ l(
|
|
495
|
+
"button",
|
|
496
|
+
{
|
|
497
|
+
type: "button",
|
|
498
|
+
onClick: () => s("theirs"),
|
|
499
|
+
className: "rounded px-1.5 py-0.5 font-medium text-amber-900 transition-colors hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-amber-50 dark:hover:bg-amber-400/15",
|
|
500
|
+
children: "Take theirs"
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
] })
|
|
504
|
+
]
|
|
505
|
+
}
|
|
506
|
+
)
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
function et({
|
|
510
|
+
controller: t,
|
|
511
|
+
cellKey: n,
|
|
512
|
+
kind: i,
|
|
513
|
+
value: c,
|
|
514
|
+
label: s,
|
|
515
|
+
choices: m,
|
|
516
|
+
target: o,
|
|
517
|
+
collection: f,
|
|
518
|
+
itemId: y,
|
|
519
|
+
field: a,
|
|
520
|
+
onCommit: x,
|
|
521
|
+
children: O
|
|
288
522
|
}) {
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
523
|
+
const I = t.editing === n, k = t.errorOf(n), p = t.savingOf(n), N = t.savedOf(n), b = f && a && y != null && y !== "" ? { collection: f, id: y, field: a } : null, A = b ? `${b.collection}|${String(b.id)}|${b.field}` : "", { watchCell: P } = t;
|
|
524
|
+
K(() => {
|
|
525
|
+
if (b)
|
|
526
|
+
return P(n, b);
|
|
527
|
+
}, [P, n, A]);
|
|
528
|
+
const S = b && !I ? t.holderOf(b) : null, C = t.refusedOf(n), _ = t.conflictOf(n), L = () => t.start(n, b ? { coords: b, value: c } : void 0);
|
|
529
|
+
if (I) {
|
|
530
|
+
const h = t.cancel;
|
|
531
|
+
if (i === "m2o" && o)
|
|
532
|
+
return /* @__PURE__ */ l(_e, { target: o, value: c, onCommit: x, onCancel: h });
|
|
533
|
+
if (i === "choice" || i === "boolean") {
|
|
534
|
+
const F = i === "boolean" ? [
|
|
296
535
|
{ value: "true", label: "Yes" },
|
|
297
536
|
{ value: "false", label: "No" }
|
|
298
|
-
] : (
|
|
299
|
-
return /* @__PURE__ */
|
|
300
|
-
|
|
537
|
+
] : (m ?? []).map((D) => ({ value: D.value, label: Z(D.label) })), M = i === "boolean" && c != null ? c === !0 || c === 1 || c === "1" || c === "true" ? "true" : "false" : c;
|
|
538
|
+
return /* @__PURE__ */ l(
|
|
539
|
+
Ie,
|
|
301
540
|
{
|
|
302
|
-
value:
|
|
303
|
-
options:
|
|
304
|
-
label:
|
|
305
|
-
onCommit: (
|
|
306
|
-
onCancel:
|
|
541
|
+
value: M,
|
|
542
|
+
options: F,
|
|
543
|
+
label: s,
|
|
544
|
+
onCommit: (D, B) => x(i === "boolean" ? D == null ? null : D === "true" : D, B),
|
|
545
|
+
onCancel: h
|
|
307
546
|
}
|
|
308
547
|
);
|
|
309
548
|
}
|
|
310
|
-
return /* @__PURE__ */
|
|
311
|
-
|
|
549
|
+
return /* @__PURE__ */ l(
|
|
550
|
+
$e,
|
|
551
|
+
{
|
|
552
|
+
kind: i,
|
|
553
|
+
value: c,
|
|
554
|
+
label: s,
|
|
555
|
+
onCommit: x,
|
|
556
|
+
onCancel: h
|
|
557
|
+
}
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
if (_)
|
|
561
|
+
return /* @__PURE__ */ l(
|
|
562
|
+
Re,
|
|
563
|
+
{
|
|
564
|
+
conflict: _,
|
|
565
|
+
kind: i,
|
|
566
|
+
choices: m,
|
|
567
|
+
target: o,
|
|
568
|
+
onKeep: (h) => t.resolveConflict(n, h)
|
|
569
|
+
}
|
|
570
|
+
);
|
|
571
|
+
if (S) {
|
|
572
|
+
const h = pe(S.name);
|
|
573
|
+
return /* @__PURE__ */ v(
|
|
574
|
+
"span",
|
|
312
575
|
{
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
576
|
+
"data-inline-held-by": S.name,
|
|
577
|
+
"data-tip": `${S.name} is editing this`,
|
|
578
|
+
style: { "--nvr-cursor": h },
|
|
579
|
+
className: "relative -mx-1 flex min-h-[22px] min-w-[48px] cursor-default items-center gap-1.5 rounded px-1 ring-1 ring-inset ring-[var(--nvr-cursor)]",
|
|
580
|
+
children: [
|
|
581
|
+
/* @__PURE__ */ l("span", { className: "min-w-0 flex-1 truncate", children: O }),
|
|
582
|
+
/* @__PURE__ */ v("span", { className: "sr-only", children: [
|
|
583
|
+
s,
|
|
584
|
+
": ",
|
|
585
|
+
S.name,
|
|
586
|
+
" is editing this"
|
|
587
|
+
] }),
|
|
588
|
+
/* @__PURE__ */ v(
|
|
589
|
+
"span",
|
|
590
|
+
{
|
|
591
|
+
"aria-hidden": "true",
|
|
592
|
+
className: "inline-flex max-w-[180px] shrink-0 items-center gap-1 text-[10.5px] leading-4 text-slate-600 dark:text-slate-300",
|
|
593
|
+
children: [
|
|
594
|
+
/* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full", style: { backgroundColor: h } }),
|
|
595
|
+
/* @__PURE__ */ l("span", { className: "min-w-0 truncate font-medium", children: S.name }),
|
|
596
|
+
" ",
|
|
597
|
+
/* @__PURE__ */ l("span", { className: "shrink-0", children: "is editing" })
|
|
598
|
+
]
|
|
599
|
+
}
|
|
600
|
+
)
|
|
601
|
+
]
|
|
318
602
|
}
|
|
319
603
|
);
|
|
320
604
|
}
|
|
@@ -325,31 +609,43 @@ function de({
|
|
|
325
609
|
{
|
|
326
610
|
role: "button",
|
|
327
611
|
tabIndex: 0,
|
|
328
|
-
"data-inline-editable":
|
|
329
|
-
"data-inline-error":
|
|
330
|
-
"aria-label": `${
|
|
331
|
-
onClick: (
|
|
332
|
-
|
|
612
|
+
"data-inline-editable": i,
|
|
613
|
+
"data-inline-error": k ? "" : void 0,
|
|
614
|
+
"aria-label": `${s}: edit`,
|
|
615
|
+
onClick: (h) => {
|
|
616
|
+
h.stopPropagation(), L();
|
|
333
617
|
},
|
|
334
|
-
onDoubleClick: (
|
|
335
|
-
onKeyDown: (
|
|
336
|
-
(
|
|
618
|
+
onDoubleClick: (h) => h.stopPropagation(),
|
|
619
|
+
onKeyDown: (h) => {
|
|
620
|
+
(h.key === "Enter" || h.key === "F2") && (h.preventDefault(), h.stopPropagation(), L());
|
|
337
621
|
},
|
|
338
|
-
className:
|
|
622
|
+
className: q(
|
|
339
623
|
"group/ie -mx-1 flex min-h-[22px] min-w-[48px] cursor-text items-center gap-1 rounded px-1 outline-none transition-colors hover:bg-slate-100 focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:bg-white/[0.06]",
|
|
340
|
-
|
|
341
|
-
|
|
624
|
+
k && "ring-1 ring-red-400 dark:ring-red-500/70",
|
|
625
|
+
p && "opacity-60"
|
|
342
626
|
),
|
|
343
627
|
children: [
|
|
344
|
-
/* @__PURE__ */
|
|
345
|
-
|
|
346
|
-
|
|
628
|
+
/* @__PURE__ */ l("span", { className: "min-w-0 flex-1 truncate", children: O }),
|
|
629
|
+
p ? /* @__PURE__ */ l(oe, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" }) : N ? /* @__PURE__ */ l(G, { className: "h-3 w-3 shrink-0 text-emerald-500 dark:text-emerald-400" }) : /* @__PURE__ */ l(ae, { className: "invisible h-3 w-3 shrink-0 text-slate-400 group-hover/ie:visible group-focus-visible/ie:visible dark:text-slate-500" }),
|
|
630
|
+
C && !k && /* @__PURE__ */ v(
|
|
631
|
+
"span",
|
|
632
|
+
{
|
|
633
|
+
className: "ml-1 max-w-[220px] shrink-0 truncate text-[10.5px] font-medium text-slate-500 dark:text-slate-400",
|
|
634
|
+
"data-inline-refused": "",
|
|
635
|
+
role: "status",
|
|
636
|
+
children: [
|
|
637
|
+
C,
|
|
638
|
+
" started editing this"
|
|
639
|
+
]
|
|
640
|
+
}
|
|
641
|
+
),
|
|
642
|
+
k && /* @__PURE__ */ l(
|
|
347
643
|
"span",
|
|
348
644
|
{
|
|
349
645
|
className: "ml-1 max-w-[220px] shrink-0 truncate text-[10.5px] font-medium text-red-600 dark:text-red-400",
|
|
350
|
-
"data-tip":
|
|
646
|
+
"data-tip": k,
|
|
351
647
|
"data-inline-refusal": "",
|
|
352
|
-
children:
|
|
648
|
+
children: k
|
|
353
649
|
}
|
|
354
650
|
)
|
|
355
651
|
]
|
|
@@ -358,6 +654,6 @@ function de({
|
|
|
358
654
|
);
|
|
359
655
|
}
|
|
360
656
|
export {
|
|
361
|
-
|
|
362
|
-
|
|
657
|
+
et as InlineEditCell,
|
|
658
|
+
Ze as useInlineEdit
|
|
363
659
|
};
|