@nivaro/react 0.2.54 → 0.2.55
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +99 -98
- package/dist/index.d.ts +339 -2
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/ItemEditForm.js +4066 -3832
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +76 -73
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +39 -32
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { badgeClasses as m } from "../../../lib/entry-badge-style.js";
|
|
3
|
+
import { cn as o } from "../../../lib/utils.js";
|
|
4
|
+
function u({
|
|
5
|
+
badge: t,
|
|
6
|
+
mode: r,
|
|
7
|
+
auto: s,
|
|
8
|
+
onMode: d
|
|
9
|
+
}) {
|
|
10
|
+
if (!t && !r) return null;
|
|
11
|
+
const n = (e, l, p) => /* @__PURE__ */ a(
|
|
12
|
+
"button",
|
|
13
|
+
{
|
|
14
|
+
type: "button",
|
|
15
|
+
"aria-pressed": r === e,
|
|
16
|
+
"data-tip": p,
|
|
17
|
+
"data-entry-mode": e,
|
|
18
|
+
onClick: () => d(e === s ? null : e),
|
|
19
|
+
className: o(
|
|
20
|
+
"h-6 rounded px-2 text-[11.5px] font-medium transition-colors",
|
|
21
|
+
r === e ? "bg-white text-slate-900 shadow-sm dark:bg-card dark:text-foreground" : "text-slate-500 hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground"
|
|
22
|
+
),
|
|
23
|
+
children: l
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
return /* @__PURE__ */ i("div", { "data-entry-strip": "", className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
27
|
+
t ? /* @__PURE__ */ a(
|
|
28
|
+
"span",
|
|
29
|
+
{
|
|
30
|
+
"data-form-badge": "",
|
|
31
|
+
"data-tip": "The form this record is open in",
|
|
32
|
+
className: o(
|
|
33
|
+
"inline-flex h-5 items-center rounded-full px-2 text-[11px] font-medium",
|
|
34
|
+
m(t.color)
|
|
35
|
+
),
|
|
36
|
+
children: t.tag
|
|
37
|
+
}
|
|
38
|
+
) : /* @__PURE__ */ a("span", {}),
|
|
39
|
+
r && /* @__PURE__ */ i(
|
|
40
|
+
"fieldset",
|
|
41
|
+
{
|
|
42
|
+
"aria-label": "How to show this form",
|
|
43
|
+
className: "m-0 inline-flex min-w-0 items-center gap-0.5 rounded-md border-0 bg-slate-100 p-0.5 dark:bg-muted",
|
|
44
|
+
children: [
|
|
45
|
+
n("beginner", "Guided steps", "One step at a time, with Next and Back"),
|
|
46
|
+
n("expert", "Tabs", "Every tab open, in any order")
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
u as EntryStrip
|
|
54
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function s(t, e) {
|
|
2
|
+
if (!(e != null && e.length)) return t;
|
|
3
|
+
const o = new Set(t), n = e.filter((r) => o.has(r)), i = new Set(n);
|
|
4
|
+
return [...n, ...t.filter((r) => !i.has(r))];
|
|
5
|
+
}
|
|
6
|
+
function a(t, e, o) {
|
|
7
|
+
const n = t.indexOf(e);
|
|
8
|
+
return n < 0 ? null : t[n + o] ?? null;
|
|
9
|
+
}
|
|
10
|
+
const u = (t) => t == null || t === "" || Array.isArray(t) && t.length === 0;
|
|
11
|
+
function l(t, e, o) {
|
|
12
|
+
for (const n of t) if (e.has(n) && u(o[n])) return n;
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const c = 'input:not([type=hidden]):not([disabled]), textarea:not([disabled]), select:not([disabled]), [role="combobox"]:not([disabled]), [contenteditable="true"], button:not([disabled])';
|
|
16
|
+
function f(t) {
|
|
17
|
+
const e = t.tagName;
|
|
18
|
+
return !!(e === "TEXTAREA" || e === "BUTTON" || e === "A" || e === "SELECT" || t.isContentEditable || t.closest('[role="listbox"], [role="menu"], [role="dialog"][data-state="open"] .cm-editor') || t.getAttribute("aria-expanded") === "true" || t.getAttribute("role") === "combobox" && t.tagName !== "INPUT");
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
c as FOCUSABLE,
|
|
22
|
+
f as enterIsTaken,
|
|
23
|
+
s as entrySequence,
|
|
24
|
+
l as firstEmptyRequired,
|
|
25
|
+
u as isEmptyValue,
|
|
26
|
+
a as stepField
|
|
27
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useRef as _, useEffect as k } from "react";
|
|
2
|
+
import { firstEmptyRequired as F, entrySequence as L, enterIsTaken as R, stepField as q, FOCUSABLE as S } from "./entry-keys.js";
|
|
3
|
+
const O = (o) => Array.from(document.querySelectorAll("[data-field]")).filter(
|
|
4
|
+
(t) => {
|
|
5
|
+
var n;
|
|
6
|
+
return t.getAttribute("data-field-collection") === o && // Fields of a nested form (a record shown inside a field) are not this form's.
|
|
7
|
+
((n = t.parentElement) == null ? void 0 : n.closest("[data-field]")) == null && t.getClientRects().length > 0;
|
|
8
|
+
}
|
|
9
|
+
), C = (o) => Array.from(o.querySelectorAll(S)).filter(
|
|
10
|
+
(t) => t.getClientRects().length > 0 && t.tabIndex !== -1
|
|
11
|
+
);
|
|
12
|
+
function v(o, t = !1) {
|
|
13
|
+
var d;
|
|
14
|
+
if (!o) return !1;
|
|
15
|
+
const n = C(o), r = t ? n[n.length - 1] : n[0];
|
|
16
|
+
return r ? (r.focus(), r instanceof HTMLInputElement && r.type === "text" && ((d = r.select) == null || d.call(r)), !0) : !1;
|
|
17
|
+
}
|
|
18
|
+
function B(o) {
|
|
19
|
+
var E;
|
|
20
|
+
const { collection: t, config: n, enabled: r, ready: d, recordKey: g } = o, m = _(o);
|
|
21
|
+
m.current = o;
|
|
22
|
+
const b = _(null);
|
|
23
|
+
k(() => {
|
|
24
|
+
if (!r || !d || !n.focus_first || b.current === g) return;
|
|
25
|
+
let y = 0;
|
|
26
|
+
const e = window.setInterval(() => {
|
|
27
|
+
y++;
|
|
28
|
+
const i = m.current, c = O(t);
|
|
29
|
+
if (c.length > 0) {
|
|
30
|
+
window.clearInterval(e), b.current = g;
|
|
31
|
+
const s = document.activeElement;
|
|
32
|
+
if (s && s !== document.body && s.closest("input, textarea, select")) return;
|
|
33
|
+
const f = c.map((p) => p.getAttribute("data-field")), a = F(f, i.required, i.draft);
|
|
34
|
+
a && v(c[f.indexOf(a)]);
|
|
35
|
+
} else y > 12 && window.clearInterval(e);
|
|
36
|
+
}, 150);
|
|
37
|
+
return () => window.clearInterval(e);
|
|
38
|
+
}, [r, d, n.focus_first, g, t]);
|
|
39
|
+
const x = r && (n.enter_next === !0 || !!((E = n.tab_order) != null && E.length));
|
|
40
|
+
k(() => {
|
|
41
|
+
if (!x) return;
|
|
42
|
+
const y = (e) => {
|
|
43
|
+
var w, h;
|
|
44
|
+
if (e.defaultPrevented || e.isComposing) return;
|
|
45
|
+
const i = e.target, c = i == null ? void 0 : i.closest("[data-field]");
|
|
46
|
+
if (!i || !c || c.getAttribute("data-field-collection") !== t || (w = c.parentElement) != null && w.closest("[data-field]")) return;
|
|
47
|
+
const s = m.current.config, f = O(t), a = f.map((l) => l.getAttribute("data-field")), p = L(a, s.tab_order), K = c.getAttribute("data-field");
|
|
48
|
+
if (e.key === "Enter" && s.enter_next) {
|
|
49
|
+
if (e.ctrlKey || e.metaKey) {
|
|
50
|
+
e.preventDefault(), m.current.save();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (e.shiftKey || e.altKey || R(i)) return;
|
|
54
|
+
const l = q(p, K, 1), u = l ? f[a.indexOf(l)] : void 0;
|
|
55
|
+
u && v(u) && e.preventDefault();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (e.key === "Tab" && ((h = s.tab_order) != null && h.length) && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
59
|
+
const l = C(c), u = l.indexOf(i);
|
|
60
|
+
if (u >= 0 && (e.shiftKey ? u > 0 : u < l.length - 1)) return;
|
|
61
|
+
const A = q(p, K, e.shiftKey ? -1 : 1), I = A ? f[a.indexOf(A)] : void 0;
|
|
62
|
+
I && v(I, e.shiftKey) && e.preventDefault();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
|
|
66
|
+
}, [x, t]);
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
B as useEntryKeyboard
|
|
70
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useQuery as h } from "@tanstack/react-query";
|
|
2
|
+
import { useState as b, useEffect as k, useCallback as v } from "react";
|
|
3
|
+
import { useNivaroClient as S } from "../../../context.js";
|
|
4
|
+
import { get as q } from "../../../lib/commands.js";
|
|
5
|
+
import { isBeginner as x } from "../../../lib/entry-config.js";
|
|
6
|
+
const I = (t, e) => `nivaro:entry-mode:${t || "anon"}:${e ?? "x"}`;
|
|
7
|
+
function y(t) {
|
|
8
|
+
try {
|
|
9
|
+
const e = localStorage.getItem(t);
|
|
10
|
+
return e === "beginner" || e === "expert" ? e : null;
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function w(t, e, a, s) {
|
|
16
|
+
const n = S();
|
|
17
|
+
return h({
|
|
18
|
+
queryKey: ["entry-records-made", t, e, a],
|
|
19
|
+
enabled: s && !!e && !!t,
|
|
20
|
+
staleTime: 5 * 6e4,
|
|
21
|
+
retry: !1,
|
|
22
|
+
queryFn: async () => {
|
|
23
|
+
var c;
|
|
24
|
+
try {
|
|
25
|
+
const o = await n.request(
|
|
26
|
+
q(`/items/${encodeURIComponent(t)}`, {
|
|
27
|
+
limit: a,
|
|
28
|
+
fields: "id",
|
|
29
|
+
filter: JSON.stringify({ user_created: { _eq: e } })
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
return ((c = o == null ? void 0 : o.data) == null ? void 0 : c.length) ?? 0;
|
|
33
|
+
} catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function N(t) {
|
|
40
|
+
const { collection: e, layoutId: a, userId: s, config: n, hasTabs: c, enabled: o } = t, l = o && n.adaptive === !0 && c, p = n.adaptive_threshold ?? 3, { data: u } = w(e, s, p, l), r = I(s, a), [g, d] = b(() => y(r));
|
|
41
|
+
k(() => d(y(r)), [r]);
|
|
42
|
+
const m = v(
|
|
43
|
+
(i) => {
|
|
44
|
+
d(i);
|
|
45
|
+
try {
|
|
46
|
+
i ? localStorage.setItem(r, i) : localStorage.removeItem(r);
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
[r]
|
|
51
|
+
);
|
|
52
|
+
if (!l || u == null) return { mode: null, switchable: !1, auto: null, set: m };
|
|
53
|
+
const f = x(u, n) ? "beginner" : "expert";
|
|
54
|
+
return { mode: g ?? f, switchable: !0, auto: f, set: m };
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
N as useEntryMode,
|
|
58
|
+
w as useRecordsMade
|
|
59
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronUp as b, ChevronDown as v } from "lucide-react";
|
|
3
|
+
import { useId as f } from "react";
|
|
4
|
+
import { foldLabel as p } from "../../lib/form-structure.js";
|
|
5
|
+
import { cn as u, titleCase as N } from "../../lib/utils.js";
|
|
6
|
+
import { Label as g } from "../ui/label.js";
|
|
7
|
+
const G = (t) => ({ ...t, label: "" }), c = (t) => t.label || N(t.field);
|
|
8
|
+
function w(t) {
|
|
9
|
+
let e = t.options;
|
|
10
|
+
if (typeof e == "string")
|
|
11
|
+
try {
|
|
12
|
+
e = JSON.parse(e);
|
|
13
|
+
} catch {
|
|
14
|
+
e = null;
|
|
15
|
+
}
|
|
16
|
+
const r = e == null ? void 0 : e.col_span;
|
|
17
|
+
return typeof r == "number" && [3, 4, 6].includes(r) ? r : 4;
|
|
18
|
+
}
|
|
19
|
+
function L({
|
|
20
|
+
row: t,
|
|
21
|
+
members: e,
|
|
22
|
+
containerWidth: r,
|
|
23
|
+
renderMember: m,
|
|
24
|
+
errors: o
|
|
25
|
+
}) {
|
|
26
|
+
const s = f(), d = e.some((l) => l.required), a = r > 0 && r < 480, x = t.label.trim() || e.map(c).join(" / "), h = e.some((l) => o == null ? void 0 : o[l.field]);
|
|
27
|
+
return /* @__PURE__ */ i(
|
|
28
|
+
"fieldset",
|
|
29
|
+
{
|
|
30
|
+
"aria-labelledby": s,
|
|
31
|
+
"data-row-group": t.key,
|
|
32
|
+
style: { gridColumn: "span 12" },
|
|
33
|
+
className: "min-w-0 space-y-1.5",
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ n("div", { className: "flex min-h-[1.5rem] items-center", children: /* @__PURE__ */ i(g, { id: s, className: u("text-sm font-medium", h && "text-destructive"), children: [
|
|
36
|
+
x,
|
|
37
|
+
d && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" })
|
|
38
|
+
] }) }),
|
|
39
|
+
/* @__PURE__ */ n("div", { className: u("flex gap-3", a ? "flex-col" : "flex-row items-start"), children: e.map((l) => /* @__PURE__ */ i(
|
|
40
|
+
"fieldset",
|
|
41
|
+
{
|
|
42
|
+
"aria-label": c(l),
|
|
43
|
+
"data-row-member": l.field,
|
|
44
|
+
className: "min-w-0",
|
|
45
|
+
style: a ? void 0 : { flex: `${w(l)} 1 0%` },
|
|
46
|
+
children: [
|
|
47
|
+
m(l),
|
|
48
|
+
/* @__PURE__ */ n("p", { className: "mt-1 truncate text-[11px] text-slate-500 dark:text-muted-foreground", children: c(l) })
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
l.field
|
|
52
|
+
)) })
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function S({
|
|
58
|
+
count: t,
|
|
59
|
+
open: e,
|
|
60
|
+
forcedOpen: r,
|
|
61
|
+
design: m,
|
|
62
|
+
onToggle: o,
|
|
63
|
+
children: s
|
|
64
|
+
}) {
|
|
65
|
+
const d = f();
|
|
66
|
+
if (t === 0) return null;
|
|
67
|
+
if (m)
|
|
68
|
+
return /* @__PURE__ */ i("div", { "data-form-fold": "design", className: "mt-4", children: [
|
|
69
|
+
/* @__PURE__ */ i("div", { className: "mb-3 flex items-center gap-2 text-[11px] text-slate-500 dark:text-muted-foreground", children: [
|
|
70
|
+
/* @__PURE__ */ i("span", { children: [
|
|
71
|
+
"Behind “",
|
|
72
|
+
p(t),
|
|
73
|
+
"” while empty"
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ n("span", { className: "h-px flex-1 bg-slate-200 dark:bg-border" })
|
|
76
|
+
] }),
|
|
77
|
+
s
|
|
78
|
+
] });
|
|
79
|
+
const a = e || r;
|
|
80
|
+
return /* @__PURE__ */ i("div", { "data-form-fold": a ? "open" : "closed", className: "mt-3", children: [
|
|
81
|
+
a && /* @__PURE__ */ n("div", { id: d, className: "nvr-expand-in", children: s }),
|
|
82
|
+
!r && /* @__PURE__ */ i(
|
|
83
|
+
"button",
|
|
84
|
+
{
|
|
85
|
+
type: "button",
|
|
86
|
+
"aria-expanded": a,
|
|
87
|
+
"aria-controls": a ? d : void 0,
|
|
88
|
+
onClick: o,
|
|
89
|
+
className: u(
|
|
90
|
+
"-ml-1.5 inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[12px] font-medium text-slate-600 transition-colors hover:bg-muted hover:text-slate-900 focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan dark:text-muted-foreground dark:hover:text-foreground motion-reduce:transition-none",
|
|
91
|
+
a && "mt-3"
|
|
92
|
+
),
|
|
93
|
+
children: [
|
|
94
|
+
a ? /* @__PURE__ */ n(b, { "aria-hidden": !0, className: "h-3.5 w-3.5" }) : /* @__PURE__ */ n(v, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
|
|
95
|
+
a ? "Show fewer" : p(t)
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] });
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
S as FoldArea,
|
|
103
|
+
L as RowGroupCell,
|
|
104
|
+
G as rowMemberField
|
|
105
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { lazySectionsOf as y } from "../../lib/layout-resolve.js";
|
|
2
|
+
const r = { groups: /* @__PURE__ */ new Set(), fields: /* @__PURE__ */ new Set() };
|
|
3
|
+
function g(s) {
|
|
4
|
+
let n = s;
|
|
5
|
+
if (typeof n == "string")
|
|
6
|
+
try {
|
|
7
|
+
n = JSON.parse(n);
|
|
8
|
+
} catch {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
return Array.isArray(n) ? n.flatMap(
|
|
12
|
+
(t) => typeof t == "string" ? [t] : t && typeof t == "object" && typeof t.field == "string" ? [t.field] : []
|
|
13
|
+
) : [];
|
|
14
|
+
}
|
|
15
|
+
function S(s, n, t = {}) {
|
|
16
|
+
var a, d;
|
|
17
|
+
if (!s || t.design) return r;
|
|
18
|
+
const f = new Set(
|
|
19
|
+
y((a = s.layout) == null ? void 0 : a.conditions)
|
|
20
|
+
);
|
|
21
|
+
if (f.size === 0) return r;
|
|
22
|
+
const p = !!((d = s.layout) != null && d.accordion_mode), i = /* @__PURE__ */ new Set();
|
|
23
|
+
for (const e of s.groups ?? [])
|
|
24
|
+
!f.has(e.key) || n.has(e.key) || e.type !== "section" && e.type !== "metadata" || (e.is_collapsed || p) && i.add(e.key);
|
|
25
|
+
if (i.size === 0) return r;
|
|
26
|
+
const o = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
|
|
27
|
+
for (const e of s.assignments ?? [])
|
|
28
|
+
e.is_visible === !1 || e.is_visible === 0 || (e.group_key && i.has(e.group_key) ? c.add(e.field) : o.add(e.field));
|
|
29
|
+
for (const e of s.groups ?? [])
|
|
30
|
+
if (i.has(e.key)) for (const l of g(e.summary_fields)) o.add(l);
|
|
31
|
+
const u = new Set([...c].filter((e) => !o.has(e)));
|
|
32
|
+
return { groups: i, fields: u };
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
S as deferredSections
|
|
36
|
+
};
|
|
@@ -1,46 +1,53 @@
|
|
|
1
1
|
import { jsxs as u, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { EyeOff as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { useQuery as h } from "@tanstack/react-query";
|
|
3
|
+
import { EyeOff as x } from "lucide-react";
|
|
4
|
+
import { useState as c, useCallback as b, useMemo as m } from "react";
|
|
5
|
+
import { useNivaroClient as y } from "../../context.js";
|
|
6
|
+
import { get as g } from "../../lib/commands.js";
|
|
7
|
+
import { currentViewport as k } from "../../lib/layout-resolve.js";
|
|
8
|
+
import { describeShowWhen as w } from "../layout-editor/show-when.js";
|
|
9
|
+
import { Popover as v, PopoverTrigger as N, PopoverContent as L } from "../ui/popover.js";
|
|
10
|
+
function P(t, r, l) {
|
|
11
|
+
const s = y(), [d, a] = c(!1), o = r == null || r === "" ? null : String(r), [e] = c(k), n = h({
|
|
12
|
+
queryKey: ["layout-why", t, o, e],
|
|
13
|
+
enabled: l.enabled && !!o && (l.eager || d),
|
|
13
14
|
staleTime: 6e4,
|
|
14
15
|
retry: !1,
|
|
15
|
-
queryFn: () =>
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
queryFn: () => s.request(
|
|
17
|
+
g("/collection-layouts/why", {
|
|
18
|
+
collection: t,
|
|
19
|
+
item: o,
|
|
20
|
+
...e ? { viewport: e } : {}
|
|
21
|
+
})
|
|
22
|
+
).then((p) => p.data ?? null)
|
|
23
|
+
}), f = b(() => a(!0), []);
|
|
24
|
+
return { data: n.data ?? null, want: f };
|
|
18
25
|
}
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
-
var
|
|
26
|
+
const O = /^(Locked for your role|Locked while the record is in |Locked by the record’s current state|The ".*" section is locked for your role|Read-only field)/;
|
|
27
|
+
function W(t, r) {
|
|
28
|
+
var s;
|
|
22
29
|
if (!r) return t;
|
|
23
30
|
const l = { ...t };
|
|
24
|
-
for (const [
|
|
25
|
-
if (!
|
|
26
|
-
const o = ((
|
|
27
|
-
o && (l[
|
|
31
|
+
for (const [d, a] of Object.entries(t)) {
|
|
32
|
+
if (!O.test(a)) continue;
|
|
33
|
+
const o = ((s = r.locks[d]) == null ? void 0 : s.text) ?? (a === "Read-only field" ? r.record_lock : null);
|
|
34
|
+
o && (l[d] = o);
|
|
28
35
|
}
|
|
29
36
|
return l;
|
|
30
37
|
}
|
|
31
|
-
function
|
|
38
|
+
function B({
|
|
32
39
|
why: t,
|
|
33
40
|
fields: r,
|
|
34
41
|
stepVisible: l
|
|
35
42
|
}) {
|
|
36
|
-
const [
|
|
43
|
+
const [s, d] = c(!1), a = m(() => {
|
|
37
44
|
const e = new Map(r.map((n) => [n.field, n.label || n.field]));
|
|
38
45
|
return (n) => e.get(n) ?? n;
|
|
39
|
-
}, [r]), o =
|
|
46
|
+
}, [r]), o = m(
|
|
40
47
|
() => (t.hidden ?? []).filter(
|
|
41
48
|
(e) => e.kind !== "step_rule" || !l({ visible_when: JSON.stringify(e.rules ?? []) })
|
|
42
49
|
).map((e) => {
|
|
43
|
-
const n = e.kind === "step_rule" ?
|
|
50
|
+
const n = e.kind === "step_rule" ? w(e.rules, r) : null;
|
|
44
51
|
return {
|
|
45
52
|
...e,
|
|
46
53
|
words: e.kind === "step_rule" ? `“${e.section_label ?? e.section}” shows only when ${n ?? "its rule matches"}` : e.text
|
|
@@ -48,15 +55,15 @@ function E({
|
|
|
48
55
|
}),
|
|
49
56
|
[t.hidden, l, r]
|
|
50
57
|
);
|
|
51
|
-
return o.length ? /* @__PURE__ */ u(
|
|
52
|
-
/* @__PURE__ */ i(
|
|
58
|
+
return o.length ? /* @__PURE__ */ u(v, { open: s, onOpenChange: d, children: [
|
|
59
|
+
/* @__PURE__ */ i(N, { asChild: !0, children: /* @__PURE__ */ u(
|
|
53
60
|
"button",
|
|
54
61
|
{
|
|
55
62
|
type: "button",
|
|
56
63
|
"data-hidden-by-rules": o.length,
|
|
57
64
|
className: "inline-flex items-center gap-1.5 self-start rounded-md border border-slate-200 bg-white px-2 py-1 text-[12px] text-slate-600 transition-colors hover:bg-muted dark:border-border dark:bg-card dark:text-muted-foreground",
|
|
58
65
|
children: [
|
|
59
|
-
/* @__PURE__ */ i(
|
|
66
|
+
/* @__PURE__ */ i(x, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
|
|
60
67
|
o.length,
|
|
61
68
|
" ",
|
|
62
69
|
o.length === 1 ? "field" : "fields",
|
|
@@ -64,7 +71,7 @@ function E({
|
|
|
64
71
|
]
|
|
65
72
|
}
|
|
66
73
|
) }),
|
|
67
|
-
/* @__PURE__ */ u(
|
|
74
|
+
/* @__PURE__ */ u(L, { align: "start", className: "w-[360px] p-0", children: [
|
|
68
75
|
/* @__PURE__ */ u("div", { className: "border-b border-slate-200 px-3 py-2 text-[12px] text-slate-500 dark:border-border dark:text-muted-foreground", children: [
|
|
69
76
|
"This record opens with the",
|
|
70
77
|
" ",
|
|
@@ -81,7 +88,7 @@ function E({
|
|
|
81
88
|
] }) : null;
|
|
82
89
|
}
|
|
83
90
|
export {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
B as HiddenByRulesNote,
|
|
92
|
+
W as refineLockReasons,
|
|
93
|
+
P as useLockWhy
|
|
87
94
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useRef as f, useEffect as s } from "react";
|
|
2
|
+
import { useNivaroClient as m } from "../../context.js";
|
|
3
|
+
import { post as p } from "../../lib/commands.js";
|
|
4
|
+
function g(u) {
|
|
5
|
+
const l = m(), t = f([]), { placement: e, open: n, search: c, settled: o, count: i } = u;
|
|
6
|
+
s(() => {
|
|
7
|
+
if (!e || !n || !o || i > 0) return;
|
|
8
|
+
const r = c.trim();
|
|
9
|
+
r.length < 2 || t.current.includes(r) || (t.current = [...t.current, r].slice(-6));
|
|
10
|
+
}, [e, n, c, o, i]), s(() => {
|
|
11
|
+
if (n || t.current.length === 0) return;
|
|
12
|
+
const r = t.current;
|
|
13
|
+
t.current = [], e && l.request(
|
|
14
|
+
p("/layout-usage/picker-miss", {
|
|
15
|
+
layout_id: e.layoutId,
|
|
16
|
+
collection: e.collection,
|
|
17
|
+
field: e.field,
|
|
18
|
+
terms: r
|
|
19
|
+
})
|
|
20
|
+
).catch(() => {
|
|
21
|
+
});
|
|
22
|
+
}, [n]);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
g as usePickerMissReport
|
|
26
|
+
};
|