@nivaro/react 0.2.51 → 0.2.53
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 +1 -1
- package/dist/index.d.ts +207 -6
- package/dist/index.js +442 -439
- package/dist/layout-editor.d.ts +80 -0
- package/dist/layout-editor.js +11 -0
- package/dist/shared/components/ItemEditForm.js +4015 -3835
- package/dist/shared/components/RecordDrilldownSheet.js +114 -97
- package/dist/shared/components/RecordReadView.js +637 -570
- package/dist/shared/components/ai/ExplainButton.js +1 -1
- package/dist/shared/components/item-edit/GroupSection.js +489 -466
- package/dist/shared/components/item-edit/HeaderBand.js +47 -44
- package/dist/shared/components/item-edit/M2MStagingContext.js +3 -3
- package/dist/shared/components/item-edit/O2MStagingContext.js +1 -1
- package/dist/shared/components/item-edit/RecordGrantTools.js +206 -0
- package/dist/shared/components/item-edit/StepsBar.js +49 -43
- package/dist/shared/components/item-edit/SummaryPanel.js +1 -1
- package/dist/shared/components/item-edit/config-update.js +6 -0
- package/dist/shared/components/item-edit/layout-editing-quiet.js +25 -0
- package/dist/shared/components/layout-editor/AddPanel.js +301 -0
- package/dist/shared/components/layout-editor/DesignNode.js +173 -0
- package/dist/shared/components/layout-editor/EditorCanvas.js +52 -0
- package/dist/shared/components/layout-editor/EditorTopBar.js +241 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +179 -0
- package/dist/shared/components/layout-editor/LayoutEditor.js +393 -0
- package/dist/shared/components/layout-editor/LayoutsRail.js +89 -0
- package/dist/shared/components/layout-editor/add-target.js +103 -0
- package/dist/shared/components/layout-editor/bundle-to-active.js +86 -0
- package/dist/shared/components/layout-editor/canvases/PdfCanvas.js +90 -0
- package/dist/shared/components/layout-editor/canvases/TableColumnsCanvas.js +246 -0
- package/dist/shared/components/layout-editor/collection-meta.js +22 -0
- package/dist/shared/components/layout-editor/design-canvas.js +81 -0
- package/dist/shared/components/layout-editor/design-context.js +21 -0
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +225 -0
- package/dist/shared/components/layout-editor/dnd/collision.js +107 -0
- package/dist/shared/components/layout-editor/dnd/node.js +164 -0
- package/dist/shared/components/layout-editor/dnd/order.js +122 -0
- package/dist/shared/components/layout-editor/editors/DefaultValuesEditor.js +223 -0
- package/dist/shared/components/layout-editor/editors/QuickPickerStepsEditor.js +129 -0
- package/dist/shared/components/layout-editor/editors/ReadPresentationEditor.js +134 -0
- package/dist/shared/components/layout-editor/editors/RecordConditionsEditor.js +249 -0
- package/dist/shared/components/layout-editor/editors/RolesPicker.js +77 -0
- package/dist/shared/components/layout-editor/editors/cascade-filters.js +556 -0
- package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +150 -0
- package/dist/shared/components/layout-editor/editors/controls.js +73 -0
- package/dist/shared/components/layout-editor/editors/editor-api.js +21 -0
- package/dist/shared/components/layout-editor/editors/editor-queries.js +25 -0
- package/dist/shared/components/layout-editor/editors/field-default-value.js +131 -0
- package/dist/shared/components/layout-editor/editors/grid-presets.js +310 -0
- package/dist/shared/components/layout-editor/editors/inline-display.js +157 -0
- package/dist/shared/components/layout-editor/editors/layout-picker.js +80 -0
- package/dist/shared/components/layout-editor/editors/layout-rows.js +55 -0
- package/dist/shared/components/layout-editor/editors/lock-conditions.js +109 -0
- package/dist/shared/components/layout-editor/editors/o2m-agg-field.js +25 -0
- package/dist/shared/components/layout-editor/editors/pdf-field-config.js +107 -0
- package/dist/shared/components/layout-editor/editors/report-widget-config.js +94 -0
- package/dist/shared/components/layout-editor/editors/row-rule-check.js +225 -0
- package/dist/shared/components/layout-editor/editors/row-rule-row.js +1353 -0
- package/dist/shared/components/layout-editor/editors/swap-config.js +245 -0
- package/dist/shared/components/layout-editor/focus-buffer.js +32 -0
- package/dist/shared/components/layout-editor/host.js +15 -0
- package/dist/shared/components/layout-editor/inspector/AdvancedTab.js +296 -0
- package/dist/shared/components/layout-editor/inspector/GridTab.js +767 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +456 -0
- package/dist/shared/components/layout-editor/inspector/HeaderItemInspector.js +268 -0
- package/dist/shared/components/layout-editor/inspector/Inspector.js +332 -0
- package/dist/shared/components/layout-editor/inspector/LookTab.js +310 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +333 -0
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +323 -0
- package/dist/shared/components/layout-editor/inspector/SlotInspector.js +179 -0
- package/dist/shared/components/layout-editor/inspector/SubtitleInspector.js +154 -0
- package/dist/shared/components/layout-editor/inspector/WidgetInspector.js +262 -0
- package/dist/shared/components/layout-editor/inspector/applies.js +27 -0
- package/dist/shared/components/layout-editor/inspector/field-context.js +134 -0
- package/dist/shared/components/layout-editor/inspector/interfaces.js +126 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +595 -0
- package/dist/shared/components/layout-editor/inspector/model.js +307 -0
- package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +121 -0
- package/dist/shared/components/layout-editor/overview/overview-api.js +141 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +62 -0
- package/dist/shared/components/layout-editor/overview/record-count.js +65 -0
- package/dist/shared/components/layout-editor/panel-frame.js +99 -0
- package/dist/shared/components/layout-editor/panel-style.js +19 -0
- package/dist/shared/components/layout-editor/pickers/field-picker.js +230 -0
- package/dist/shared/components/layout-editor/pickers/icon-picker.js +233 -0
- package/dist/shared/components/layout-editor/pickers/relation-label.js +34 -0
- package/dist/shared/components/layout-editor/pickers/relation-picker.js +136 -0
- package/dist/shared/components/layout-editor/record-queries.js +15 -0
- package/dist/shared/components/layout-editor/settings/AddendumSection.js +52 -0
- package/dist/shared/components/layout-editor/settings/ButtonsSection.js +45 -0
- package/dist/shared/components/layout-editor/settings/DefaultsSection.js +67 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +146 -0
- package/dist/shared/components/layout-editor/settings/InheritanceSection.js +37 -0
- package/dist/shared/components/layout-editor/settings/LayoutSection.js +70 -0
- package/dist/shared/components/layout-editor/settings/PdfSection.js +176 -0
- package/dist/shared/components/layout-editor/settings/ReadSection.js +79 -0
- package/dist/shared/components/layout-editor/settings/TextSetting.js +55 -0
- package/dist/shared/components/layout-editor/settings/ToggleSetting.js +33 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +179 -0
- package/dist/shared/components/layout-editor/settings/WhoSection.js +213 -0
- package/dist/shared/components/layout-editor/settings/controls.js +214 -0
- package/dist/shared/components/layout-editor/settings/section-props.js +17 -0
- package/dist/shared/components/layout-editor/settings/settings-api.js +151 -0
- package/dist/shared/components/layout-editor/settings/settings-registry.js +445 -0
- package/dist/shared/components/layout-editor/slot-names.js +20 -0
- package/dist/shared/components/layout-editor/summary-pref.js +21 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +474 -0
- package/dist/shared/components/pipeline/relations.js +28 -23
- package/dist/shared/components/ui/popover.js +17 -17
- package/dist/shared/components/ui/scroll-area.js +38 -0
- package/dist/shared/hooks/useRelationOptions.js +60 -0
- package/dist/shared/lib/layout-grants.js +9 -0
- package/dist/shared/lib/layout-ops.js +348 -0
- package/dist/shared/lib/layout-slots.js +11 -7
- package/dist/shared/lib/request-gate.js +1 -1
- package/package.json +5 -1
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import * as
|
|
4
|
-
import { ChevronDown as
|
|
5
|
-
import
|
|
6
|
-
import { fieldDrilldownConfig as
|
|
7
|
-
import { get as
|
|
8
|
-
import { useRecordReader as
|
|
9
|
-
import { choiceLabel as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
1
|
+
import { jsx as e, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as te, useQueryClient as Xe } from "@tanstack/react-query";
|
|
3
|
+
import * as et from "lucide-react";
|
|
4
|
+
import { ChevronDown as tt, Loader2 as nt, User as rt, Mail as it } from "lucide-react";
|
|
5
|
+
import Ce, { useState as ne, useRef as ce, useEffect as lt } from "react";
|
|
6
|
+
import { fieldDrilldownConfig as st, useDrilldown as at, useOptionalNivaroClient as re, useNavigation as ot } from "../../context.js";
|
|
7
|
+
import { get as Re, post as ct } from "../../lib/commands.js";
|
|
8
|
+
import { useRecordReader as ze } from "../../lib/record-loader.js";
|
|
9
|
+
import { choiceLabel as dt, titleCase as Ke, cn as ee } from "../../lib/utils.js";
|
|
10
|
+
import { DesignDropZone as ut, designWrap as pt } from "../layout-editor/DesignNode.js";
|
|
11
|
+
import { useLayoutDesign as mt } from "../layout-editor/design-context.js";
|
|
12
|
+
import { UserAvatar as ft } from "../UserAvatar.js";
|
|
13
|
+
import { DropdownMenu as ht, DropdownMenuTrigger as gt, DropdownMenuContent as bt, DropdownMenuItem as Oe } from "../ui/dropdown-menu.js";
|
|
14
|
+
import { WidgetSlot as Le } from "../WidgetSlot.js";
|
|
15
|
+
import { FieldRow as Be } from "./FieldRow.js";
|
|
16
|
+
import { applyDisplayTemplate as xt, useContainerWidth as yt, resolveColSpan as Ue } from "./helpers.js";
|
|
17
|
+
import { UserChip as Ge, OwnersInline as Ie, OwnersInlineCompact as Nt } from "./UserChip.js";
|
|
18
|
+
import { UserRosterCluster as Wt } from "./UserChip.js";
|
|
19
|
+
function Te(t) {
|
|
18
20
|
if (typeof t != "string") return t ?? [];
|
|
19
21
|
try {
|
|
20
22
|
return JSON.parse(t);
|
|
@@ -22,94 +24,94 @@ function je(t) {
|
|
|
22
24
|
return [];
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
|
-
function
|
|
27
|
+
function _t({
|
|
26
28
|
relCollection: t,
|
|
27
29
|
relId: r,
|
|
28
30
|
entries: i,
|
|
29
31
|
separator: u
|
|
30
32
|
}) {
|
|
31
|
-
const l =
|
|
32
|
-
queryKey: ["inline-display", t, n,
|
|
33
|
-
queryFn: () =>
|
|
33
|
+
const l = re(), a = ze(), n = String(r), p = i.some((h) => h.field.includes(".")) ? ["id", ...i.map((h) => h.field)].join(",") : null, { data: f } = te({
|
|
34
|
+
queryKey: ["inline-display", t, n, p],
|
|
35
|
+
queryFn: () => a(t, n, p),
|
|
34
36
|
enabled: !!l && !!n,
|
|
35
37
|
staleTime: 6e4
|
|
36
38
|
});
|
|
37
|
-
if (!
|
|
39
|
+
if (!f) return null;
|
|
38
40
|
const v = (h) => {
|
|
39
|
-
let
|
|
40
|
-
for (const
|
|
41
|
-
if (
|
|
42
|
-
|
|
41
|
+
let m = f;
|
|
42
|
+
for (const g of h.split(".")) {
|
|
43
|
+
if (m == null || typeof m != "object") return;
|
|
44
|
+
m = m[g];
|
|
43
45
|
}
|
|
44
|
-
return
|
|
46
|
+
return m;
|
|
45
47
|
};
|
|
46
48
|
if (u != null) {
|
|
47
49
|
const h = ($) => {
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
+
const _ = v($.field);
|
|
51
|
+
if (_ == null || _ === "") return null;
|
|
50
52
|
const w = $.format ?? "text";
|
|
51
53
|
if (w === "date" || w === "datetime")
|
|
52
54
|
try {
|
|
53
|
-
return new Date(String(
|
|
55
|
+
return new Date(String(_)).toLocaleDateString();
|
|
54
56
|
} catch {
|
|
55
|
-
return String(
|
|
57
|
+
return String(_);
|
|
56
58
|
}
|
|
57
|
-
return w === "boolean" ?
|
|
58
|
-
},
|
|
59
|
-
let
|
|
59
|
+
return w === "boolean" ? _ ? "Yes" : "No" : String(_);
|
|
60
|
+
}, m = [];
|
|
61
|
+
let g = [];
|
|
60
62
|
for (const $ of i)
|
|
61
|
-
$.line_break &&
|
|
62
|
-
|
|
63
|
-
const j =
|
|
64
|
-
($) => $.map((
|
|
65
|
-
const w = h(
|
|
66
|
-
return w ? { label:
|
|
63
|
+
$.line_break && g.length > 0 ? (m.push(g), g = [$]) : g.push($);
|
|
64
|
+
g.length > 0 && m.push(g);
|
|
65
|
+
const j = m.map(
|
|
66
|
+
($) => $.map((_) => {
|
|
67
|
+
const w = h(_);
|
|
68
|
+
return w ? { label: _.label ?? null, display: w } : null;
|
|
67
69
|
}).filter(Boolean)
|
|
68
70
|
).filter(($) => $.length > 0);
|
|
69
|
-
return j.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: j.map(($,
|
|
71
|
+
return j.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1", children: j.map(($, _) => (
|
|
70
72
|
// biome-ignore lint/suspicious/noArrayIndexKey: stable line order
|
|
71
|
-
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: $.map((w,
|
|
73
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: $.map((w, P) => (
|
|
72
74
|
// biome-ignore lint/suspicious/noArrayIndexKey: stable token order
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
75
|
-
w.label && /* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ N(Ce.Fragment, { children: [
|
|
76
|
+
P > 0 && u,
|
|
77
|
+
w.label && /* @__PURE__ */ N("span", { className: "font-semibold text-slate-600 dark:text-slate-300", children: [
|
|
76
78
|
w.label,
|
|
77
79
|
":"
|
|
78
80
|
] }),
|
|
79
81
|
w.label ? " " : "",
|
|
80
82
|
w.display
|
|
81
|
-
] },
|
|
82
|
-
)) },
|
|
83
|
+
] }, P)
|
|
84
|
+
)) }, _)
|
|
83
85
|
)) });
|
|
84
86
|
}
|
|
85
87
|
const c = i.map((h) => {
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
const
|
|
88
|
+
const m = v(h.field);
|
|
89
|
+
if (m == null || m === "") return null;
|
|
90
|
+
const g = h.format ?? "text";
|
|
89
91
|
let j;
|
|
90
|
-
if (
|
|
92
|
+
if (g === "date" || g === "datetime")
|
|
91
93
|
try {
|
|
92
|
-
j = new Date(String(
|
|
94
|
+
j = new Date(String(m)).toLocaleDateString();
|
|
93
95
|
} catch {
|
|
94
|
-
j = String(
|
|
96
|
+
j = String(m);
|
|
95
97
|
}
|
|
96
|
-
else
|
|
98
|
+
else g === "boolean" ? j = m ? "Yes" : "No" : j = String(m);
|
|
97
99
|
return { label: h.label, display: j };
|
|
98
100
|
}).filter(Boolean);
|
|
99
|
-
return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1 rounded border border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800/50 px-3 py-1.5 space-y-0.5", children: c.map((h,
|
|
101
|
+
return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: "mt-1 rounded border border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800/50 px-3 py-1.5 space-y-0.5", children: c.map((h, m) => (
|
|
100
102
|
// biome-ignore lint/suspicious/noArrayIndexKey: stable order from config
|
|
101
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ N("div", { className: "flex items-baseline gap-2", children: [
|
|
102
104
|
h.label && /* @__PURE__ */ e("span", { className: "shrink-0 min-w-[56px] text-[10px] font-medium text-slate-400", children: h.label }),
|
|
103
105
|
/* @__PURE__ */ e("span", { className: "text-[12px] text-slate-700 dark:text-slate-300 truncate", children: h.display })
|
|
104
|
-
] },
|
|
106
|
+
] }, m)
|
|
105
107
|
)) });
|
|
106
108
|
}
|
|
107
|
-
function
|
|
109
|
+
function wt(t) {
|
|
108
110
|
if (!t) return null;
|
|
109
|
-
const r = t.replace(/(^|-)([a-z])/g, (u, l,
|
|
111
|
+
const r = t.replace(/(^|-)([a-z])/g, (u, l, a) => a.toUpperCase()), i = et[r];
|
|
110
112
|
return i || null;
|
|
111
113
|
}
|
|
112
|
-
function
|
|
114
|
+
function qe(t) {
|
|
113
115
|
if (!t.options) return {};
|
|
114
116
|
if (typeof t.options == "object") return t.options;
|
|
115
117
|
try {
|
|
@@ -118,7 +120,7 @@ function Oe(t) {
|
|
|
118
120
|
return {};
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
|
-
function
|
|
123
|
+
function de(t, r) {
|
|
122
124
|
if (t == null || t === "") return "—";
|
|
123
125
|
if (typeof t == "boolean") return t ? "Yes" : "No";
|
|
124
126
|
const i = (r == null ? void 0 : r.interface) ?? "", u = (() => {
|
|
@@ -136,12 +138,12 @@ function ae(t, r) {
|
|
|
136
138
|
if (u === "percent" && Number.isFinite(n)) return `${(n * 100).toFixed(1)}%`;
|
|
137
139
|
if (/^0\.0+$/.test(u) && Number.isFinite(n)) return n.toFixed(u.length - 2);
|
|
138
140
|
if (u === "date" && typeof t == "string") {
|
|
139
|
-
const
|
|
140
|
-
if (!Number.isNaN(
|
|
141
|
+
const o = t.length === 10 ? /* @__PURE__ */ new Date(`${t}T00:00:00`) : new Date(t);
|
|
142
|
+
if (!Number.isNaN(o.getTime())) return o.toLocaleDateString();
|
|
141
143
|
}
|
|
142
144
|
if (u === "datetime" && typeof t == "string") {
|
|
143
|
-
const
|
|
144
|
-
if (!Number.isNaN(
|
|
145
|
+
const o = new Date(t);
|
|
146
|
+
if (!Number.isNaN(o.getTime())) return o.toLocaleString();
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
if (i === "duration" && Number.isFinite(Number(t))) {
|
|
@@ -153,7 +155,7 @@ function ae(t, r) {
|
|
|
153
155
|
if (i === "checklist" && typeof t == "string")
|
|
154
156
|
try {
|
|
155
157
|
const n = JSON.parse(t);
|
|
156
|
-
if (Array.isArray(n)) return `${n.filter((
|
|
158
|
+
if (Array.isArray(n)) return `${n.filter((o) => o == null ? void 0 : o.done).length}/${n.length} done`;
|
|
157
159
|
} catch {
|
|
158
160
|
}
|
|
159
161
|
if (i === "address" && typeof t == "string" && t.trim().startsWith("{"))
|
|
@@ -178,98 +180,98 @@ function ae(t, r) {
|
|
|
178
180
|
let n = /^\d{4}-\d{2}-\d{2}$/.test(l) || i === "date";
|
|
179
181
|
if (!n && (r != null && r.options))
|
|
180
182
|
try {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
+
const p = typeof r.options == "string" ? JSON.parse(r.options) : r.options;
|
|
184
|
+
p && p.date_mode === "date" && (n = !0);
|
|
183
185
|
} catch {
|
|
184
186
|
}
|
|
185
|
-
const
|
|
186
|
-
return
|
|
187
|
+
const o = l.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/);
|
|
188
|
+
return o ? new Date(Number(o[1]), Number(o[2]) - 1, Number(o[3])).toLocaleDateString() : n ? new Date(l).toLocaleDateString() : new Date(l).toLocaleString();
|
|
187
189
|
} catch {
|
|
188
190
|
}
|
|
189
191
|
if ((i === "select-dropdown" || i === "radio-buttons") && r) {
|
|
190
|
-
const
|
|
191
|
-
if (Array.isArray(
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
192
|
+
const o = qe(r).choices;
|
|
193
|
+
if (Array.isArray(o)) {
|
|
194
|
+
const p = o.find((f) => String(f.value) === l);
|
|
195
|
+
if (p) return dt(p.text);
|
|
194
196
|
}
|
|
195
197
|
}
|
|
196
|
-
const
|
|
197
|
-
if (!Number.isNaN(
|
|
198
|
-
const n =
|
|
199
|
-
if (
|
|
200
|
-
const
|
|
201
|
-
if (
|
|
198
|
+
const a = Number(l);
|
|
199
|
+
if (!Number.isNaN(a) && l !== "" && r) {
|
|
200
|
+
const n = qe(r), o = n.format, p = typeof n.unit == "string" ? n.unit.trim() : "";
|
|
201
|
+
if (p && !o) {
|
|
202
|
+
const f = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(a);
|
|
203
|
+
if (p === "$")
|
|
202
204
|
try {
|
|
203
205
|
return new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(
|
|
204
|
-
|
|
206
|
+
a
|
|
205
207
|
);
|
|
206
208
|
} catch {
|
|
207
|
-
return `$${
|
|
209
|
+
return `$${f}`;
|
|
208
210
|
}
|
|
209
|
-
return
|
|
211
|
+
return p === "%" ? `${f}%` : `${f} ${p}`;
|
|
210
212
|
}
|
|
211
|
-
if (
|
|
213
|
+
if (o === "currency")
|
|
212
214
|
try {
|
|
213
215
|
return new Intl.NumberFormat(void 0, {
|
|
214
216
|
style: "currency",
|
|
215
217
|
currency: n.currency || "USD"
|
|
216
|
-
}).format(
|
|
218
|
+
}).format(a);
|
|
217
219
|
} catch {
|
|
218
220
|
}
|
|
219
|
-
if (
|
|
220
|
-
return new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(
|
|
221
|
-
if (
|
|
222
|
-
const
|
|
221
|
+
if (o === "int")
|
|
222
|
+
return new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(a);
|
|
223
|
+
if (o === "decimal") {
|
|
224
|
+
const f = typeof n.precision == "number" ? n.precision : 2;
|
|
223
225
|
return new Intl.NumberFormat(void 0, {
|
|
224
|
-
minimumFractionDigits:
|
|
225
|
-
maximumFractionDigits:
|
|
226
|
-
}).format(
|
|
226
|
+
minimumFractionDigits: f,
|
|
227
|
+
maximumFractionDigits: f
|
|
228
|
+
}).format(a);
|
|
227
229
|
}
|
|
228
230
|
}
|
|
229
|
-
return !l.includes(" ") && !l.includes("@") && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(l) && !/^\d+$/.test(l) && (l.includes("_") || l.includes("-") || /^[a-z]/.test(l)) ?
|
|
231
|
+
return !l.includes(" ") && !l.includes("@") && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(l) && !/^\d+$/.test(l) && (l.includes("_") || l.includes("-") || /^[a-z]/.test(l)) ? Ke(l) : l;
|
|
230
232
|
}
|
|
231
|
-
function
|
|
232
|
-
const r =
|
|
233
|
+
function Me({ userId: t }) {
|
|
234
|
+
const r = re(), { navigate: i, userUrl: u } = ot(), l = u ? u(t) : `/users/${t}`, { data: a } = te({
|
|
233
235
|
queryKey: ["user-chip", t],
|
|
234
236
|
queryFn: () => r.request(
|
|
235
|
-
|
|
236
|
-
).then((
|
|
237
|
+
Re(`/users/${t}`)
|
|
238
|
+
).then((p) => p.data ?? null),
|
|
237
239
|
enabled: !!r && !!t,
|
|
238
240
|
staleTime: 12e4
|
|
239
|
-
}), n =
|
|
240
|
-
return /* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */ e(
|
|
241
|
+
}), n = a ? [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email : t, o = n.split(" ").map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
242
|
+
return /* @__PURE__ */ N(ht, { children: [
|
|
243
|
+
/* @__PURE__ */ e(gt, { asChild: !0, children: /* @__PURE__ */ N("span", { className: "inline-flex cursor-pointer items-center gap-1 rounded-full bg-slate-100 py-px pl-0.5 pr-2 hover:bg-slate-200 transition-colors", children: [
|
|
242
244
|
/* @__PURE__ */ e(
|
|
243
|
-
|
|
245
|
+
ft,
|
|
244
246
|
{
|
|
245
247
|
userId: t,
|
|
246
248
|
className: "h-4 w-4",
|
|
247
|
-
fallback: /* @__PURE__ */ e("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[9px] font-bold text-nvr-navy dark:text-nvr-cyan", children:
|
|
249
|
+
fallback: /* @__PURE__ */ e("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/20 text-[9px] font-bold text-nvr-navy dark:text-nvr-cyan", children: o })
|
|
248
250
|
}
|
|
249
251
|
),
|
|
250
252
|
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-600", children: n })
|
|
251
253
|
] }) }),
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
l && /* @__PURE__ */
|
|
254
|
-
|
|
254
|
+
/* @__PURE__ */ N(bt, { align: "start", className: "text-[12px]", children: [
|
|
255
|
+
l && /* @__PURE__ */ N(
|
|
256
|
+
Oe,
|
|
255
257
|
{
|
|
256
258
|
className: "gap-2 text-[12px] cursor-pointer",
|
|
257
259
|
onSelect: () => i(l),
|
|
258
260
|
children: [
|
|
259
|
-
/* @__PURE__ */ e(
|
|
261
|
+
/* @__PURE__ */ e(rt, { className: "h-3.5 w-3.5" }),
|
|
260
262
|
" View profile"
|
|
261
263
|
]
|
|
262
264
|
}
|
|
263
265
|
),
|
|
264
|
-
(
|
|
265
|
-
|
|
266
|
+
(a == null ? void 0 : a.email) && /* @__PURE__ */ N(
|
|
267
|
+
Oe,
|
|
266
268
|
{
|
|
267
269
|
className: "gap-2 text-[12px] cursor-pointer",
|
|
268
270
|
onSelect: () => {
|
|
269
|
-
window.location.href = `mailto:${
|
|
271
|
+
window.location.href = `mailto:${a.email}`;
|
|
270
272
|
},
|
|
271
273
|
children: [
|
|
272
|
-
/* @__PURE__ */ e(
|
|
274
|
+
/* @__PURE__ */ e(it, { className: "h-3.5 w-3.5" }),
|
|
273
275
|
" Send email"
|
|
274
276
|
]
|
|
275
277
|
}
|
|
@@ -277,42 +279,42 @@ function Le({ userId: t }) {
|
|
|
277
279
|
] })
|
|
278
280
|
] });
|
|
279
281
|
}
|
|
280
|
-
function
|
|
282
|
+
function vt({
|
|
281
283
|
collection: t,
|
|
282
284
|
itemId: r,
|
|
283
285
|
layoutId: i,
|
|
284
286
|
attachField: u,
|
|
285
287
|
filenameTemplate: l,
|
|
286
|
-
label:
|
|
288
|
+
label: a
|
|
287
289
|
}) {
|
|
288
|
-
const n =
|
|
289
|
-
if (!(!n ||
|
|
290
|
-
|
|
290
|
+
const n = re(), o = Xe(), [p, f] = ne(!1), v = async () => {
|
|
291
|
+
if (!(!n || p || !u)) {
|
|
292
|
+
f(!0);
|
|
291
293
|
try {
|
|
292
294
|
await n.request(
|
|
293
|
-
|
|
295
|
+
ct(`/collection-layouts/${i}/generate-and-attach`, {
|
|
294
296
|
collection: t,
|
|
295
297
|
item_id: r,
|
|
296
298
|
attach_field: u,
|
|
297
299
|
filename_template: l ?? void 0
|
|
298
300
|
})
|
|
299
|
-
),
|
|
301
|
+
), o.invalidateQueries({ queryKey: ["m2m-items"] }), o.invalidateQueries({ queryKey: ["items", t, r] });
|
|
300
302
|
} catch {
|
|
301
303
|
} finally {
|
|
302
|
-
|
|
304
|
+
f(!1);
|
|
303
305
|
}
|
|
304
306
|
}
|
|
305
307
|
}, c = !u;
|
|
306
|
-
return /* @__PURE__ */
|
|
308
|
+
return /* @__PURE__ */ N(
|
|
307
309
|
"button",
|
|
308
310
|
{
|
|
309
311
|
type: "button",
|
|
310
312
|
onClick: v,
|
|
311
|
-
disabled:
|
|
313
|
+
disabled: p || c,
|
|
312
314
|
title: c ? "Configure PDF field in Data Model → Layouts" : void 0,
|
|
313
315
|
className: "inline-flex items-center gap-1.5 rounded-md border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/20 disabled:cursor-not-allowed disabled:opacity-40 dark:text-nvr-cyan",
|
|
314
316
|
children: [
|
|
315
|
-
/* @__PURE__ */
|
|
317
|
+
/* @__PURE__ */ N(
|
|
316
318
|
"svg",
|
|
317
319
|
{
|
|
318
320
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -329,47 +331,47 @@ function ft({
|
|
|
329
331
|
]
|
|
330
332
|
}
|
|
331
333
|
),
|
|
332
|
-
|
|
334
|
+
p ? "Generating…" : a
|
|
333
335
|
]
|
|
334
336
|
}
|
|
335
337
|
);
|
|
336
338
|
}
|
|
337
|
-
function
|
|
339
|
+
function Q({
|
|
338
340
|
relCollection: t,
|
|
339
341
|
id: r,
|
|
340
342
|
className: i
|
|
341
343
|
}) {
|
|
342
|
-
var
|
|
343
|
-
const u =
|
|
344
|
+
var m;
|
|
345
|
+
const u = re(), l = ze(), a = r != null && r !== "" ? String(r) : null, { data: n } = te({
|
|
344
346
|
queryKey: ["col-meta-dt", t],
|
|
345
347
|
queryFn: () => u.request(
|
|
346
|
-
|
|
347
|
-
).then((
|
|
348
|
-
enabled: !!u && !!
|
|
348
|
+
Re(`/collections/${t}`)
|
|
349
|
+
).then((g) => g.data).catch(() => ({})),
|
|
350
|
+
enabled: !!u && !!a,
|
|
349
351
|
staleTime: 3e5
|
|
350
|
-
}),
|
|
351
|
-
queryKey: ["rel-display", t,
|
|
352
|
-
queryFn: () => l(t,
|
|
353
|
-
enabled: !!u && !!
|
|
352
|
+
}), o = (((m = n == null ? void 0 : n.display_template) == null ? void 0 : m.match(/\{\{\s*[^}]+?\s*\}\}/g)) ?? []).map((g) => g.replace(/[{}\s]/g, "")).filter((g) => g.includes(".")), p = o.length ? ["id", ...o].join(",") : null, { data: f, isLoading: v } = te({
|
|
353
|
+
queryKey: ["rel-display", t, a, p],
|
|
354
|
+
queryFn: () => l(t, a, p),
|
|
355
|
+
enabled: !!u && !!a && n !== void 0,
|
|
354
356
|
staleTime: 6e4
|
|
355
357
|
});
|
|
356
|
-
if (!
|
|
358
|
+
if (!a) return /* @__PURE__ */ e("span", { children: "—" });
|
|
357
359
|
if (v || u && n === void 0)
|
|
358
360
|
return /* @__PURE__ */ e("span", { className: "animate-pulse h-3 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] inline-block" });
|
|
359
361
|
const c = i ?? "text-[13px] text-slate-700";
|
|
360
|
-
if (!
|
|
361
|
-
const h = n != null && n.display_template ?
|
|
362
|
+
if (!f) return /* @__PURE__ */ e("span", { className: c, children: a });
|
|
363
|
+
const h = n != null && n.display_template ? xt(n.display_template, f) : String(f.name ?? f.title ?? f.label ?? f.display_name ?? a);
|
|
362
364
|
return /* @__PURE__ */ e("span", { className: c, children: h });
|
|
363
365
|
}
|
|
364
|
-
function
|
|
365
|
-
return /* @__PURE__ */ e(
|
|
366
|
+
function Je({ userId: t }) {
|
|
367
|
+
return /* @__PURE__ */ e(Ge, { userId: t, size: "compact" });
|
|
366
368
|
}
|
|
367
|
-
function
|
|
369
|
+
function Pe({
|
|
368
370
|
relCollection: t,
|
|
369
371
|
id: r,
|
|
370
372
|
drillConfig: i
|
|
371
373
|
}) {
|
|
372
|
-
const u =
|
|
374
|
+
const u = at(), l = /* @__PURE__ */ e(Q, { relCollection: t, id: r });
|
|
373
375
|
return !u || r == null || r === "" ? l : /* @__PURE__ */ e(
|
|
374
376
|
"button",
|
|
375
377
|
{
|
|
@@ -386,7 +388,7 @@ function Ue({
|
|
|
386
388
|
},
|
|
387
389
|
className: "group/drill cursor-pointer text-left transition-colors",
|
|
388
390
|
children: /* @__PURE__ */ e(
|
|
389
|
-
|
|
391
|
+
Q,
|
|
390
392
|
{
|
|
391
393
|
relCollection: t,
|
|
392
394
|
id: r,
|
|
@@ -396,45 +398,45 @@ function Ue({
|
|
|
396
398
|
}
|
|
397
399
|
);
|
|
398
400
|
}
|
|
399
|
-
function
|
|
400
|
-
const [r, i] =
|
|
401
|
-
return
|
|
402
|
-
const
|
|
401
|
+
function St(t) {
|
|
402
|
+
const [r, i] = ne(!1), u = ce(!0), l = ce(JSON.stringify(t ?? null));
|
|
403
|
+
return lt(() => {
|
|
404
|
+
const a = JSON.stringify(t ?? null);
|
|
403
405
|
if (u.current) {
|
|
404
|
-
u.current = !1, l.current =
|
|
406
|
+
u.current = !1, l.current = a;
|
|
405
407
|
return;
|
|
406
408
|
}
|
|
407
|
-
if (
|
|
408
|
-
l.current =
|
|
409
|
-
const n = window.setTimeout(() => i(!0), 0),
|
|
409
|
+
if (a === l.current) return;
|
|
410
|
+
l.current = a, i(!1);
|
|
411
|
+
const n = window.setTimeout(() => i(!0), 0), o = window.setTimeout(() => i(!1), 1200);
|
|
410
412
|
return () => {
|
|
411
|
-
window.clearTimeout(n), window.clearTimeout(
|
|
413
|
+
window.clearTimeout(n), window.clearTimeout(o);
|
|
412
414
|
};
|
|
413
415
|
}, [t]), r ? "nvr-value-pulse" : "";
|
|
414
416
|
}
|
|
415
|
-
function
|
|
417
|
+
function zt({
|
|
416
418
|
field: t,
|
|
417
419
|
val: r,
|
|
418
420
|
relations: i,
|
|
419
421
|
collection: u,
|
|
420
422
|
displayFormat: l,
|
|
421
|
-
textClassName:
|
|
423
|
+
textClassName: a
|
|
422
424
|
}) {
|
|
423
|
-
const n =
|
|
425
|
+
const n = St(r), o = ee(a ?? "text-[13px] text-slate-900 dark:text-slate-100", n), p = st(t) ?? { enabled: !0, layout_id: null, width: null }, f = i.find(
|
|
424
426
|
(c) => c.one_collection === u && c.one_field === t.field && c.junction_field
|
|
425
427
|
);
|
|
426
|
-
if (
|
|
428
|
+
if (f) {
|
|
427
429
|
const c = i.find(
|
|
428
|
-
(
|
|
429
|
-
), h = c == null ? void 0 : c.one_collection,
|
|
430
|
-
return !h ||
|
|
431
|
-
|
|
430
|
+
(g) => g.many_collection === f.many_collection && g.many_field === f.junction_field
|
|
431
|
+
), h = c == null ? void 0 : c.one_collection, m = Array.isArray(r) ? r : r != null && r !== "" ? [r] : [];
|
|
432
|
+
return !h || m.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : h === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: m.map((g) => /* @__PURE__ */ e(Je, { userId: String(g) }, String(g))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: m.map((g) => /* @__PURE__ */ e(
|
|
433
|
+
Pe,
|
|
432
434
|
{
|
|
433
435
|
relCollection: h,
|
|
434
|
-
id:
|
|
435
|
-
drillConfig:
|
|
436
|
+
id: g,
|
|
437
|
+
drillConfig: p
|
|
436
438
|
},
|
|
437
|
-
String(
|
|
439
|
+
String(g)
|
|
438
440
|
)) });
|
|
439
441
|
}
|
|
440
442
|
const v = i.find(
|
|
@@ -442,12 +444,12 @@ function Lt({
|
|
|
442
444
|
);
|
|
443
445
|
if (v != null && v.one_collection) {
|
|
444
446
|
const c = Array.isArray(r) ? r : r != null && r !== "" ? [r] : [];
|
|
445
|
-
return c.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : v.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: c.map((h) => /* @__PURE__ */ e(
|
|
446
|
-
|
|
447
|
+
return c.length === 0 ? /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : v.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1 gap-y-0.5", children: c.map((h) => /* @__PURE__ */ e(Je, { userId: String(h) }, String(h))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: c.map((h) => /* @__PURE__ */ e(
|
|
448
|
+
Pe,
|
|
447
449
|
{
|
|
448
450
|
relCollection: v.one_collection,
|
|
449
451
|
id: h,
|
|
450
|
-
drillConfig:
|
|
452
|
+
drillConfig: p
|
|
451
453
|
},
|
|
452
454
|
String(h)
|
|
453
455
|
)) });
|
|
@@ -457,421 +459,438 @@ function Lt({
|
|
|
457
459
|
if (l && l !== "text") {
|
|
458
460
|
const c = Number(r);
|
|
459
461
|
if (l === "currency" && !isNaN(c))
|
|
460
|
-
return /* @__PURE__ */ e("span", { className: `font-semibold ${
|
|
462
|
+
return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, {
|
|
461
463
|
style: "currency",
|
|
462
464
|
currency: "USD",
|
|
463
465
|
minimumFractionDigits: 2
|
|
464
466
|
}).format(c) });
|
|
465
467
|
if (l === "integer" && !isNaN(c))
|
|
466
|
-
return /* @__PURE__ */ e("span", { className: `font-semibold ${
|
|
468
|
+
return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(Math.round(c)) });
|
|
467
469
|
if (l === "decimal" && !isNaN(c))
|
|
468
|
-
return /* @__PURE__ */ e("span", { className: `font-semibold ${
|
|
470
|
+
return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(c) });
|
|
469
471
|
if (l === "percent" && !isNaN(c))
|
|
470
|
-
return /* @__PURE__ */ e("span", { className: `font-semibold ${
|
|
472
|
+
return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(
|
|
471
473
|
c / 100
|
|
472
474
|
) });
|
|
473
475
|
if (l === "date")
|
|
474
476
|
try {
|
|
475
|
-
return /* @__PURE__ */ e("span", { className: `font-semibold ${
|
|
477
|
+
return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Date(String(r)).toLocaleDateString() });
|
|
476
478
|
} catch {
|
|
477
479
|
}
|
|
478
480
|
if (l === "datetime")
|
|
479
481
|
try {
|
|
480
|
-
return /* @__PURE__ */ e("span", { className: `font-semibold ${
|
|
482
|
+
return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: new Date(String(r)).toLocaleString() });
|
|
481
483
|
} catch {
|
|
482
484
|
}
|
|
483
485
|
}
|
|
484
|
-
return /* @__PURE__ */ e("span", { className: `font-semibold ${
|
|
486
|
+
return /* @__PURE__ */ e("span", { className: `font-semibold ${o}`, children: de(r, t) });
|
|
485
487
|
}
|
|
486
|
-
function
|
|
488
|
+
function kt({
|
|
487
489
|
summaryFields: t,
|
|
488
490
|
fields: r,
|
|
489
491
|
draft: i,
|
|
490
492
|
relations: u,
|
|
491
493
|
collection: l,
|
|
492
|
-
itemId:
|
|
494
|
+
itemId: a,
|
|
493
495
|
ownersCollection: n,
|
|
494
|
-
ownersItemId:
|
|
495
|
-
ownersAssignment:
|
|
496
|
-
m2mCounts:
|
|
496
|
+
ownersItemId: o,
|
|
497
|
+
ownersAssignment: p,
|
|
498
|
+
m2mCounts: f,
|
|
497
499
|
o2mCounts: v,
|
|
498
500
|
o2mAggValues: c,
|
|
499
501
|
summaryAggConfigs: h,
|
|
500
|
-
o2mLoading:
|
|
501
|
-
hideEmpty:
|
|
502
|
+
o2mLoading: m,
|
|
503
|
+
hideEmpty: g
|
|
502
504
|
}) {
|
|
503
|
-
const j = t.map((
|
|
504
|
-
if (
|
|
505
|
-
if (
|
|
506
|
-
if (v &&
|
|
507
|
-
const B = i[
|
|
505
|
+
const j = t.map((b) => typeof b == "string" ? b : b.field), $ = g ? j.filter((b) => {
|
|
506
|
+
if (b === "__owners__" || m != null && m.has(b) || c && b in c) return !0;
|
|
507
|
+
if (f && b in f) return (f[b] ?? 0) > 0;
|
|
508
|
+
if (v && b in v) return (v[b] ?? 0) > 0;
|
|
509
|
+
const B = i[b];
|
|
508
510
|
return B != null && B !== "" && !(Array.isArray(B) && B.length === 0);
|
|
509
511
|
}) : j;
|
|
510
512
|
if ($.length === 0) return null;
|
|
511
|
-
const
|
|
512
|
-
if (
|
|
513
|
-
const d = (
|
|
514
|
-
return /* @__PURE__ */
|
|
515
|
-
/* @__PURE__ */ e("span", { className:
|
|
513
|
+
const _ = "text-[9px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500 shrink-0", w = "text-[12px] font-semibold text-slate-700 dark:text-slate-300", P = "text-[12px] text-slate-300 dark:text-slate-600", C = "flex items-baseline gap-1.5", ie = (b) => {
|
|
514
|
+
if (b === "__owners__") {
|
|
515
|
+
const d = (p == null ? void 0 : p.label_override) || "Owners";
|
|
516
|
+
return /* @__PURE__ */ N("div", { className: "flex items-center gap-1.5", children: [
|
|
517
|
+
/* @__PURE__ */ e("span", { className: _, children: d }),
|
|
516
518
|
/* @__PURE__ */ e(
|
|
517
|
-
|
|
519
|
+
Nt,
|
|
518
520
|
{
|
|
519
521
|
collection: n ?? l,
|
|
520
|
-
itemId:
|
|
522
|
+
itemId: o ?? a
|
|
521
523
|
}
|
|
522
524
|
)
|
|
523
525
|
] });
|
|
524
526
|
}
|
|
525
|
-
const B = t.find((d) => (typeof d == "string" ? d : d.field) ===
|
|
526
|
-
if (
|
|
527
|
-
return /* @__PURE__ */
|
|
528
|
-
/* @__PURE__ */ e("span", { className:
|
|
529
|
-
/* @__PURE__ */ e(
|
|
527
|
+
const B = t.find((d) => (typeof d == "string" ? d : d.field) === b), A = B && typeof B != "string" ? B.label : void 0, K = r.find((d) => d.field === b), U = A || (K == null ? void 0 : K.label) || b.replace(/_/g, " ").replace(/\b\w/g, (d) => d.toUpperCase());
|
|
528
|
+
if (m != null && m.has(b))
|
|
529
|
+
return /* @__PURE__ */ N("div", { className: "flex items-center gap-1.5", children: [
|
|
530
|
+
/* @__PURE__ */ e("span", { className: _, children: U }),
|
|
531
|
+
/* @__PURE__ */ e(nt, { className: "h-3 w-3 animate-spin text-slate-300" })
|
|
530
532
|
] });
|
|
531
|
-
if (c &&
|
|
532
|
-
const d = h == null ? void 0 : h[
|
|
533
|
-
let
|
|
533
|
+
if (c && b in c) {
|
|
534
|
+
const d = h == null ? void 0 : h[b], L = (d == null ? void 0 : d.label) || U, F = c[b];
|
|
535
|
+
let T;
|
|
534
536
|
if ((d == null ? void 0 : d.agg) === "count")
|
|
535
|
-
|
|
537
|
+
T = String(F);
|
|
536
538
|
else {
|
|
537
|
-
const
|
|
539
|
+
const R = d != null && d.field_options ? (() => {
|
|
538
540
|
try {
|
|
539
541
|
return JSON.parse(d.field_options);
|
|
540
542
|
} catch {
|
|
541
543
|
return {};
|
|
542
544
|
}
|
|
543
|
-
})() : {},
|
|
544
|
-
if (
|
|
545
|
+
})() : {}, G = R.format;
|
|
546
|
+
if (G === "currency")
|
|
545
547
|
try {
|
|
546
|
-
|
|
548
|
+
T = new Intl.NumberFormat(void 0, {
|
|
547
549
|
style: "currency",
|
|
548
|
-
currency:
|
|
550
|
+
currency: R.currency || "USD"
|
|
549
551
|
}).format(F);
|
|
550
552
|
} catch {
|
|
551
|
-
|
|
553
|
+
T = F.toLocaleString(void 0, { maximumFractionDigits: 2 });
|
|
552
554
|
}
|
|
553
|
-
else if (
|
|
554
|
-
|
|
555
|
-
else if (
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
minimumFractionDigits:
|
|
559
|
-
maximumFractionDigits:
|
|
555
|
+
else if (G === "int")
|
|
556
|
+
T = new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(F);
|
|
557
|
+
else if (G === "decimal") {
|
|
558
|
+
const V = typeof R.precision == "number" ? R.precision : 2;
|
|
559
|
+
T = new Intl.NumberFormat(void 0, {
|
|
560
|
+
minimumFractionDigits: V,
|
|
561
|
+
maximumFractionDigits: V
|
|
560
562
|
}).format(F);
|
|
561
563
|
} else
|
|
562
|
-
|
|
564
|
+
T = F.toLocaleString(void 0, { maximumFractionDigits: 2 });
|
|
563
565
|
}
|
|
564
|
-
return /* @__PURE__ */
|
|
565
|
-
/* @__PURE__ */ e("span", { className:
|
|
566
|
-
/* @__PURE__ */ e("span", { className: w, children:
|
|
566
|
+
return /* @__PURE__ */ N("div", { className: C, children: [
|
|
567
|
+
/* @__PURE__ */ e("span", { className: _, children: L }),
|
|
568
|
+
/* @__PURE__ */ e("span", { className: w, children: T })
|
|
567
569
|
] });
|
|
568
570
|
}
|
|
569
|
-
if (
|
|
570
|
-
const d =
|
|
571
|
-
return /* @__PURE__ */
|
|
572
|
-
/* @__PURE__ */ e("span", { className:
|
|
573
|
-
/* @__PURE__ */
|
|
571
|
+
if (f && b in f) {
|
|
572
|
+
const d = f[b];
|
|
573
|
+
return /* @__PURE__ */ N("div", { className: C, children: [
|
|
574
|
+
/* @__PURE__ */ e("span", { className: _, children: U }),
|
|
575
|
+
/* @__PURE__ */ N("span", { className: w, children: [
|
|
574
576
|
d,
|
|
575
577
|
" item",
|
|
576
578
|
d !== 1 ? "s" : ""
|
|
577
579
|
] })
|
|
578
580
|
] });
|
|
579
581
|
}
|
|
580
|
-
if (v &&
|
|
581
|
-
const d = v[
|
|
582
|
-
return /* @__PURE__ */
|
|
583
|
-
/* @__PURE__ */ e("span", { className:
|
|
584
|
-
/* @__PURE__ */
|
|
582
|
+
if (v && b in v) {
|
|
583
|
+
const d = v[b];
|
|
584
|
+
return /* @__PURE__ */ N("div", { className: C, children: [
|
|
585
|
+
/* @__PURE__ */ e("span", { className: _, children: U }),
|
|
586
|
+
/* @__PURE__ */ N("span", { className: w, children: [
|
|
585
587
|
d,
|
|
586
588
|
" row",
|
|
587
589
|
d !== 1 ? "s" : ""
|
|
588
590
|
] })
|
|
589
591
|
] });
|
|
590
592
|
}
|
|
591
|
-
const
|
|
592
|
-
(d) => d.many_collection === l && d.many_field ===
|
|
593
|
+
const k = i[b], I = u.find(
|
|
594
|
+
(d) => d.many_collection === l && d.many_field === b && !d.junction_field
|
|
593
595
|
);
|
|
594
|
-
if (
|
|
595
|
-
const d = Array.isArray(
|
|
596
|
-
return /* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */ e("span", { className:
|
|
598
|
-
d.length === 0 ? /* @__PURE__ */ e("span", { className:
|
|
596
|
+
if (I != null && I.one_collection) {
|
|
597
|
+
const d = Array.isArray(k) ? k : k != null && k !== "" ? [k] : [];
|
|
598
|
+
return /* @__PURE__ */ N("div", { className: C, children: [
|
|
599
|
+
/* @__PURE__ */ e("span", { className: _, children: U }),
|
|
600
|
+
d.length === 0 ? /* @__PURE__ */ e("span", { className: P, children: "—" }) : I.one_collection === "nivaro_users" ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: d.map((L) => /* @__PURE__ */ e(Me, { userId: String(L) }, String(L))) }) : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((L) => /* @__PURE__ */ e(Q, { relCollection: I.one_collection, id: L }, String(L))) })
|
|
599
601
|
] });
|
|
600
602
|
}
|
|
601
|
-
if (Array.isArray(
|
|
602
|
-
const d = u.find((F) => F.many_field ===
|
|
603
|
-
return /* @__PURE__ */
|
|
604
|
-
/* @__PURE__ */ e("span", { className:
|
|
605
|
-
|
|
606
|
-
(F) => L === "nivaro_users" ? /* @__PURE__ */ e(
|
|
607
|
-
) }) : /* @__PURE__ */
|
|
608
|
-
|
|
603
|
+
if (Array.isArray(k)) {
|
|
604
|
+
const d = u.find((F) => F.many_field === b && F.junction_field), L = d == null ? void 0 : d.one_collection;
|
|
605
|
+
return /* @__PURE__ */ N("div", { className: C, children: [
|
|
606
|
+
/* @__PURE__ */ e("span", { className: _, children: U }),
|
|
607
|
+
k.length === 0 ? /* @__PURE__ */ e("span", { className: P, children: "—" }) : L ? /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5 gap-y-0.5", children: k.map(
|
|
608
|
+
(F) => L === "nivaro_users" ? /* @__PURE__ */ e(Me, { userId: String(F) }, String(F)) : /* @__PURE__ */ e(Q, { relCollection: L, id: F }, String(F))
|
|
609
|
+
) }) : /* @__PURE__ */ N("span", { className: w, children: [
|
|
610
|
+
k.length,
|
|
609
611
|
" item",
|
|
610
|
-
|
|
612
|
+
k.length !== 1 ? "s" : ""
|
|
611
613
|
] })
|
|
612
614
|
] });
|
|
613
615
|
}
|
|
614
|
-
return /* @__PURE__ */
|
|
615
|
-
/* @__PURE__ */ e("span", { className:
|
|
616
|
-
|
|
616
|
+
return /* @__PURE__ */ N("div", { className: C, children: [
|
|
617
|
+
/* @__PURE__ */ e("span", { className: _, children: U }),
|
|
618
|
+
k == null || k === "" ? /* @__PURE__ */ e("span", { className: P, children: "—" }) : /* @__PURE__ */ e("span", { className: w, children: de(k, K) })
|
|
617
619
|
] });
|
|
618
620
|
};
|
|
619
|
-
return /* @__PURE__ */ e("div", { className: "flex flex-wrap items-baseline gap-x-5 gap-y-1.5 border-t border-slate-100 dark:border-border/60 bg-slate-50/50 dark:bg-white/[0.015] px-5 py-2.5", children: $.map((
|
|
621
|
+
return /* @__PURE__ */ e("div", { className: "flex flex-wrap items-baseline gap-x-5 gap-y-1.5 border-t border-slate-100 dark:border-border/60 bg-slate-50/50 dark:bg-white/[0.015] px-5 py-2.5", children: $.map((b) => /* @__PURE__ */ e(Ce.Fragment, { children: ie(b) }, b)) });
|
|
620
622
|
}
|
|
621
|
-
function
|
|
623
|
+
function Kt({
|
|
622
624
|
group: t,
|
|
623
625
|
fields: r,
|
|
624
626
|
draft: i,
|
|
625
627
|
onChange: u,
|
|
626
628
|
relations: l,
|
|
627
|
-
collection:
|
|
629
|
+
collection: a,
|
|
628
630
|
itemId: n,
|
|
629
|
-
errors:
|
|
630
|
-
visibleFields:
|
|
631
|
-
lockedFields:
|
|
631
|
+
errors: o,
|
|
632
|
+
visibleFields: p,
|
|
633
|
+
lockedFields: f,
|
|
632
634
|
layoutAiEnabled: v,
|
|
633
635
|
displayOnly: c,
|
|
634
636
|
renderField: h,
|
|
635
|
-
onCountChange:
|
|
636
|
-
isNew:
|
|
637
|
+
onCountChange: m,
|
|
638
|
+
isNew: g,
|
|
637
639
|
fieldValues: j,
|
|
638
640
|
isOpen: $,
|
|
639
|
-
onToggle:
|
|
641
|
+
onToggle: _,
|
|
640
642
|
summaryFields: w,
|
|
641
|
-
m2mCounts:
|
|
642
|
-
o2mCounts:
|
|
643
|
-
o2mAggValues:
|
|
644
|
-
summaryAggConfigs:
|
|
643
|
+
m2mCounts: P,
|
|
644
|
+
o2mCounts: C,
|
|
645
|
+
o2mAggValues: ie,
|
|
646
|
+
summaryAggConfigs: b,
|
|
645
647
|
o2mLoading: B,
|
|
646
|
-
footerSlot:
|
|
648
|
+
footerSlot: A,
|
|
647
649
|
ownersCollection: K,
|
|
648
650
|
ownersItemId: U,
|
|
649
|
-
ownersAssignment:
|
|
650
|
-
pdfAssignment:
|
|
651
|
+
ownersAssignment: k,
|
|
652
|
+
pdfAssignment: I,
|
|
651
653
|
pdfAttachField: d,
|
|
652
654
|
pdfFilenameTemplate: L,
|
|
653
655
|
layoutId: F,
|
|
654
|
-
hideEmptySummary:
|
|
655
|
-
widgetAssignments:
|
|
656
|
-
widgetApiBase:
|
|
657
|
-
fieldInlineDisplay:
|
|
658
|
-
swapConfig:
|
|
659
|
-
swapped:
|
|
660
|
-
onSwapToggle:
|
|
656
|
+
hideEmptySummary: T,
|
|
657
|
+
widgetAssignments: R,
|
|
658
|
+
widgetApiBase: G,
|
|
659
|
+
fieldInlineDisplay: V,
|
|
660
|
+
swapConfig: q,
|
|
661
|
+
swapped: ue,
|
|
662
|
+
onSwapToggle: pe,
|
|
661
663
|
alternateFields: E,
|
|
662
|
-
alternateWidths:
|
|
664
|
+
alternateWidths: le
|
|
663
665
|
}) {
|
|
664
|
-
const [
|
|
665
|
-
if (
|
|
666
|
-
const
|
|
667
|
-
let
|
|
668
|
-
if (t.hide_when_empty && j && (
|
|
669
|
-
(
|
|
670
|
-
) && !
|
|
671
|
-
const
|
|
672
|
-
return /* @__PURE__ */
|
|
666
|
+
const [Ve, We] = ne(t.is_collapsed ?? !1), M = mt(), W = (x, s) => pt(M, x, s, { asChild: !0 }), Z = (x) => ({ kind: "slot", field: x, group_key: t.key }), me = !!(M != null && M.showHidden), [fe, he] = ne({}), ge = _ !== void 0, H = ge ? !$ : Ve, Ee = ge ? _ : () => We((x) => !x), He = !c && r.some((x) => o[x.field]), be = M ? "always" : t.visibility_mode ?? "always";
|
|
667
|
+
if (be === "new_only" && !g || be === "existing_only" && g) return null;
|
|
668
|
+
const Y = R ?? [], Ye = !g && Y.some((x) => x.widget_id != null && fe[x.field] === void 0);
|
|
669
|
+
let se = !1;
|
|
670
|
+
if (t.hide_when_empty && j && !M && (se = j.every(
|
|
671
|
+
(s) => s == null || s === "" || Array.isArray(s) && s.length === 0
|
|
672
|
+
) && !Ye && Y.every((s) => !fe[s.field])), se && Y.length === 0) return null;
|
|
673
|
+
const ae = ce(null), xe = yt(ae), ye = wt(t.icon), Qe = me ? r : r.filter((x) => !x.hidden), Ne = (x) => me && (x.hidden || !(p.has(x.field) || !p.size));
|
|
674
|
+
return /* @__PURE__ */ N(
|
|
673
675
|
"div",
|
|
674
676
|
{
|
|
675
|
-
className:
|
|
677
|
+
className: ee(
|
|
676
678
|
"nvr-section-enter rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
|
|
677
679
|
c && "bg-slate-50/60 dark:bg-slate-900/20",
|
|
678
|
-
|
|
680
|
+
se && "hidden"
|
|
679
681
|
),
|
|
680
682
|
children: [
|
|
681
|
-
/* @__PURE__ */
|
|
683
|
+
/* @__PURE__ */ N(
|
|
682
684
|
"button",
|
|
683
685
|
{
|
|
684
686
|
type: "button",
|
|
685
|
-
onClick:
|
|
686
|
-
|
|
687
|
+
onClick: Ee,
|
|
688
|
+
"data-design-group-header": M ? "" : void 0,
|
|
689
|
+
className: ee(
|
|
687
690
|
"flex w-full items-center gap-2 px-5 py-3 text-left hover:bg-slate-50/50 dark:hover:bg-white/[0.02] rounded-t-xl",
|
|
688
691
|
// Round the bottom only when nothing renders below the header — an
|
|
689
692
|
// expanded body (or collapsed summary strip) square-joins it, and a
|
|
690
693
|
// rounded hover overlay would leave see-through notches at the seam.
|
|
691
|
-
|
|
694
|
+
H && !(w && w.length > 0) && "rounded-b-xl"
|
|
692
695
|
),
|
|
693
696
|
children: [
|
|
694
|
-
|
|
697
|
+
ye && /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500" }),
|
|
695
698
|
/* @__PURE__ */ e("span", { className: "font-medium text-[13px] shrink-0 text-slate-800 dark:text-slate-200", children: t.label }),
|
|
696
699
|
/* @__PURE__ */ e("span", { className: "flex-1" }),
|
|
697
|
-
|
|
700
|
+
He && /* @__PURE__ */ e("span", { className: "nvr-pop h-2 w-2 rounded-full bg-destructive shrink-0" }),
|
|
698
701
|
/* @__PURE__ */ e(
|
|
699
|
-
|
|
702
|
+
tt,
|
|
700
703
|
{
|
|
701
|
-
|
|
704
|
+
"data-design-pass": M ? "" : void 0,
|
|
705
|
+
className: ee(
|
|
702
706
|
"h-4 w-4 text-slate-400 dark:text-slate-500 transition-transform duration-200",
|
|
703
|
-
|
|
707
|
+
H && "-rotate-90"
|
|
704
708
|
)
|
|
705
709
|
}
|
|
706
710
|
)
|
|
707
711
|
]
|
|
708
712
|
}
|
|
709
713
|
),
|
|
710
|
-
|
|
711
|
-
|
|
714
|
+
H && w && w.length > 0 && /* @__PURE__ */ e(
|
|
715
|
+
kt,
|
|
712
716
|
{
|
|
713
717
|
summaryFields: w,
|
|
714
718
|
fields: r,
|
|
715
719
|
draft: i,
|
|
716
720
|
relations: l,
|
|
717
|
-
collection:
|
|
721
|
+
collection: a,
|
|
718
722
|
itemId: n,
|
|
719
723
|
ownersCollection: K,
|
|
720
724
|
ownersItemId: U,
|
|
721
|
-
ownersAssignment:
|
|
722
|
-
m2mCounts:
|
|
723
|
-
o2mCounts:
|
|
724
|
-
o2mAggValues:
|
|
725
|
-
summaryAggConfigs:
|
|
725
|
+
ownersAssignment: k,
|
|
726
|
+
m2mCounts: P,
|
|
727
|
+
o2mCounts: C,
|
|
728
|
+
o2mAggValues: ie,
|
|
729
|
+
summaryAggConfigs: b,
|
|
726
730
|
o2mLoading: B,
|
|
727
|
-
hideEmpty: !!t.summary_hide_empty || !!
|
|
731
|
+
hideEmpty: !!t.summary_hide_empty || !!T
|
|
728
732
|
}
|
|
729
733
|
),
|
|
730
|
-
|
|
731
|
-
|
|
734
|
+
H && t.hide_when_empty && Y.length > 0 && /* @__PURE__ */ e("div", { className: "hidden", children: Y.filter((x) => x.widget_id != null).map((x) => /* @__PURE__ */ e(
|
|
735
|
+
Le,
|
|
732
736
|
{
|
|
733
|
-
widgetId:
|
|
734
|
-
inputBindings:
|
|
737
|
+
widgetId: x.widget_id,
|
|
738
|
+
inputBindings: Te(x.input_bindings),
|
|
735
739
|
itemDraft: i,
|
|
736
740
|
frameless: !0,
|
|
737
|
-
apiBase:
|
|
738
|
-
onContentChange: (
|
|
739
|
-
(y) => y[
|
|
741
|
+
apiBase: G,
|
|
742
|
+
onContentChange: (s) => he(
|
|
743
|
+
(y) => y[x.field] === s ? y : { ...y, [x.field]: s }
|
|
740
744
|
)
|
|
741
745
|
},
|
|
742
|
-
|
|
746
|
+
x.field
|
|
743
747
|
)) }),
|
|
744
|
-
!
|
|
748
|
+
!H && /* @__PURE__ */ N("div", { className: "nvr-expand-in border-t border-slate-100 px-5 py-4", children: [
|
|
745
749
|
(() => {
|
|
746
|
-
const
|
|
747
|
-
_k:
|
|
748
|
-
sort:
|
|
750
|
+
const x = Qe.map((s) => ({
|
|
751
|
+
_k: s.field,
|
|
752
|
+
sort: s.sort ?? 0,
|
|
749
753
|
_t: "field",
|
|
750
|
-
f:
|
|
754
|
+
f: s
|
|
751
755
|
}));
|
|
752
|
-
|
|
756
|
+
k && x.push({
|
|
753
757
|
_k: "__owners__",
|
|
754
|
-
sort:
|
|
758
|
+
sort: k.sort,
|
|
755
759
|
_t: "owners",
|
|
756
|
-
slot:
|
|
757
|
-
}),
|
|
760
|
+
slot: k
|
|
761
|
+
}), I && x.push({
|
|
758
762
|
_k: "__pdf__",
|
|
759
|
-
sort:
|
|
763
|
+
sort: I.sort,
|
|
760
764
|
_t: "pdf",
|
|
761
|
-
slot:
|
|
765
|
+
slot: I
|
|
762
766
|
});
|
|
763
|
-
for (const
|
|
764
|
-
|
|
765
|
-
return
|
|
766
|
-
if (
|
|
767
|
-
const
|
|
768
|
-
return
|
|
767
|
+
for (const s of R ?? [])
|
|
768
|
+
x.push({ _k: s.field, sort: s.sort, _t: "widget", slot: s });
|
|
769
|
+
return x.sort((s, y) => s.sort - y.sort), M && x.length === 0 ? /* @__PURE__ */ e(ut, {}) : c ? /* @__PURE__ */ e("div", { ref: ae, className: "grid grid-cols-12 gap-x-6 gap-y-3", children: x.map((s) => {
|
|
770
|
+
if (s._t === "owners") {
|
|
771
|
+
const D = s.slot.col_span ?? 12;
|
|
772
|
+
return W(
|
|
773
|
+
Z("__owners__"),
|
|
774
|
+
/* @__PURE__ */ e(
|
|
775
|
+
"div",
|
|
776
|
+
{
|
|
777
|
+
className: "min-w-0",
|
|
778
|
+
style: { gridColumn: `span ${D}` },
|
|
779
|
+
children: /* @__PURE__ */ e(
|
|
780
|
+
Ie,
|
|
781
|
+
{
|
|
782
|
+
collection: a,
|
|
783
|
+
itemId: n,
|
|
784
|
+
label: s.slot.label_override || "Owners"
|
|
785
|
+
}
|
|
786
|
+
)
|
|
787
|
+
},
|
|
788
|
+
"__owners__"
|
|
789
|
+
)
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
if (s._t === "pdf" || s._t === "widget") return null;
|
|
793
|
+
const y = s.f, O = l.find(
|
|
794
|
+
(D) => D.many_collection === a && D.many_field === y.field && !D.junction_field
|
|
795
|
+
);
|
|
796
|
+
return W(
|
|
797
|
+
{ kind: "field", field: y.field, group_key: t.key },
|
|
798
|
+
/* @__PURE__ */ N(
|
|
769
799
|
"div",
|
|
770
800
|
{
|
|
771
801
|
className: "min-w-0",
|
|
772
|
-
style: { gridColumn: `span ${
|
|
773
|
-
children:
|
|
774
|
-
|
|
775
|
-
{
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
)
|
|
802
|
+
style: { gridColumn: `span ${Ue(y.options, xe)}` },
|
|
803
|
+
children: [
|
|
804
|
+
/* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: y.label || Ke(y.field) }),
|
|
805
|
+
/* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (O == null ? void 0 : O.one_collection) === "nivaro_users" ? (() => {
|
|
806
|
+
const D = i[y.field], X = Array.isArray(D) ? D : D != null && D !== "" ? [D] : [];
|
|
807
|
+
return X.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: X.map((z) => /* @__PURE__ */ e(Ge, { userId: String(z) }, String(z))) });
|
|
808
|
+
})() : O != null && O.one_collection ? /* @__PURE__ */ e(Q, { relCollection: O.one_collection, id: i[y.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: de(i[y.field], y) }) })
|
|
809
|
+
]
|
|
781
810
|
},
|
|
782
|
-
|
|
783
|
-
)
|
|
784
|
-
}
|
|
785
|
-
if (o._t === "pdf" || o._t === "widget") return null;
|
|
786
|
-
const y = o.f, O = l.find(
|
|
787
|
-
(k) => k.many_collection === s && k.many_field === y.field && !k.junction_field
|
|
788
|
-
);
|
|
789
|
-
return /* @__PURE__ */ g(
|
|
790
|
-
"div",
|
|
791
|
-
{
|
|
792
|
-
className: "min-w-0",
|
|
793
|
-
style: { gridColumn: `span ${$e(y.options, fe)}` },
|
|
794
|
-
children: [
|
|
795
|
-
/* @__PURE__ */ e("dt", { className: "text-[11px] font-medium text-slate-400 truncate", children: y.label || Me(y.field) }),
|
|
796
|
-
/* @__PURE__ */ e("dd", { className: "mt-0.5 break-words", children: (O == null ? void 0 : O.one_collection) === "nivaro_users" ? (() => {
|
|
797
|
-
const k = i[y.field], H = Array.isArray(k) ? k : k != null && k !== "" ? [k] : [];
|
|
798
|
-
return H.length === 0 ? /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-400", children: "—" }) : /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: H.map((R) => /* @__PURE__ */ e(Je, { userId: String(R) }, String(R))) });
|
|
799
|
-
})() : O != null && O.one_collection ? /* @__PURE__ */ e(Y, { relCollection: O.one_collection, id: i[y.field] }) : /* @__PURE__ */ e("span", { className: "text-[13px] text-slate-700", children: ae(i[y.field], y) }) })
|
|
800
|
-
]
|
|
801
|
-
},
|
|
802
|
-
y.field
|
|
811
|
+
y.field
|
|
812
|
+
)
|
|
803
813
|
);
|
|
804
|
-
}) }) : /* @__PURE__ */ e("div", { ref:
|
|
805
|
-
var
|
|
806
|
-
if (
|
|
807
|
-
const S =
|
|
808
|
-
return
|
|
809
|
-
|
|
810
|
-
{
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
814
|
+
}) }) : /* @__PURE__ */ e("div", { ref: ae, className: "grid grid-cols-12 gap-4 items-start", children: x.map((s) => {
|
|
815
|
+
var $e, Fe;
|
|
816
|
+
if (s._t === "owners") {
|
|
817
|
+
const S = s.slot.col_span ?? 12;
|
|
818
|
+
return W(
|
|
819
|
+
Z("__owners__"),
|
|
820
|
+
/* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
|
|
821
|
+
Ie,
|
|
822
|
+
{
|
|
823
|
+
collection: a,
|
|
824
|
+
itemId: n,
|
|
825
|
+
label: s.slot.label_override || "Owners"
|
|
826
|
+
}
|
|
827
|
+
) }, "__owners__")
|
|
828
|
+
);
|
|
816
829
|
}
|
|
817
|
-
if (
|
|
830
|
+
if (s._t === "pdf") {
|
|
818
831
|
if (!F) return null;
|
|
819
|
-
const S =
|
|
820
|
-
return
|
|
821
|
-
|
|
822
|
-
{
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
832
|
+
const S = s.slot.col_span ?? 12, J = (($e = s.slot.label_override) == null ? void 0 : $e.trim()) || "Generate PDF";
|
|
833
|
+
return W(
|
|
834
|
+
Z("__pdf__"),
|
|
835
|
+
/* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
|
|
836
|
+
vt,
|
|
837
|
+
{
|
|
838
|
+
collection: a,
|
|
839
|
+
itemId: n,
|
|
840
|
+
layoutId: F,
|
|
841
|
+
attachField: d ?? null,
|
|
842
|
+
filenameTemplate: L,
|
|
843
|
+
label: J
|
|
844
|
+
}
|
|
845
|
+
) }, "__pdf__")
|
|
846
|
+
);
|
|
831
847
|
}
|
|
832
|
-
if (
|
|
833
|
-
if (!
|
|
834
|
-
const S =
|
|
835
|
-
return
|
|
836
|
-
|
|
837
|
-
{
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
848
|
+
if (s._t === "widget") {
|
|
849
|
+
if (!s.slot.widget_id) return null;
|
|
850
|
+
const S = s.slot.col_span ?? 12, J = Te(s.slot.input_bindings);
|
|
851
|
+
return W(
|
|
852
|
+
Z(s.slot.field),
|
|
853
|
+
/* @__PURE__ */ e("div", { style: { gridColumn: `span ${S}` }, children: /* @__PURE__ */ e(
|
|
854
|
+
Le,
|
|
855
|
+
{
|
|
856
|
+
widgetId: s.slot.widget_id,
|
|
857
|
+
inputBindings: J,
|
|
858
|
+
itemDraft: i,
|
|
859
|
+
label: s.slot.label_override ?? void 0,
|
|
860
|
+
defaultExpanded: s.slot.default_expanded ?? !0,
|
|
861
|
+
frameless: !0,
|
|
862
|
+
apiBase: G,
|
|
863
|
+
onContentChange: (je) => he(
|
|
864
|
+
(oe) => oe[s.slot.field] === je ? oe : { ...oe, [s.slot.field]: je }
|
|
865
|
+
)
|
|
866
|
+
}
|
|
867
|
+
) }, s.slot.field)
|
|
868
|
+
);
|
|
850
869
|
}
|
|
851
|
-
const y =
|
|
852
|
-
(S) => S.many_collection ===
|
|
853
|
-
)) == null ? void 0 :
|
|
854
|
-
const S = i[(
|
|
870
|
+
const y = s.f, O = V == null ? void 0 : V[y.field], D = O == null ? void 0 : O.entries, X = (O == null ? void 0 : O.separator) ?? null, z = i[y.field], _e = z != null && z !== "", we = D != null && D.length && _e ? ((Fe = l.find(
|
|
871
|
+
(S) => S.many_collection === a && S.many_field === y.field && !S.junction_field
|
|
872
|
+
)) == null ? void 0 : Fe.one_collection) ?? null : null, ve = (q == null ? void 0 : q.enabled) && y.field === q.primary_field, Se = (() => {
|
|
873
|
+
const S = i[(q == null ? void 0 : q.primary_field) ?? ""];
|
|
855
874
|
return S != null && S !== "";
|
|
856
|
-
})(),
|
|
857
|
-
const
|
|
858
|
-
return
|
|
859
|
-
}),
|
|
875
|
+
})(), ke = (E ?? []).some((S) => {
|
|
876
|
+
const J = i[S.field];
|
|
877
|
+
return J != null && J !== "";
|
|
878
|
+
}), Ae = ve && pe ? /* @__PURE__ */ N("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
860
879
|
/* @__PURE__ */ e(
|
|
861
880
|
"button",
|
|
862
881
|
{
|
|
863
882
|
type: "button",
|
|
864
|
-
onClick:
|
|
883
|
+
onClick: pe,
|
|
865
884
|
className: "inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 transition-colors",
|
|
866
|
-
children:
|
|
885
|
+
children: ue ? q.back_label ?? "Back" : q.toggle_label ?? "Enter manually"
|
|
867
886
|
}
|
|
868
887
|
),
|
|
869
|
-
/* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ N(
|
|
870
889
|
"span",
|
|
871
890
|
{
|
|
872
891
|
className: [
|
|
873
892
|
"inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
|
|
874
|
-
|
|
893
|
+
Se ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
|
|
875
894
|
].join(" "),
|
|
876
895
|
title: "Original field",
|
|
877
896
|
children: [
|
|
@@ -880,7 +899,7 @@ function Bt({
|
|
|
880
899
|
{
|
|
881
900
|
className: [
|
|
882
901
|
"h-1.5 w-1.5 rounded-full",
|
|
883
|
-
|
|
902
|
+
Se ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
|
|
884
903
|
].join(" ")
|
|
885
904
|
}
|
|
886
905
|
),
|
|
@@ -888,12 +907,12 @@ function Bt({
|
|
|
888
907
|
]
|
|
889
908
|
}
|
|
890
909
|
),
|
|
891
|
-
/* @__PURE__ */
|
|
910
|
+
/* @__PURE__ */ N(
|
|
892
911
|
"span",
|
|
893
912
|
{
|
|
894
913
|
className: [
|
|
895
914
|
"inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[9px] font-medium",
|
|
896
|
-
|
|
915
|
+
ke ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
|
|
897
916
|
].join(" "),
|
|
898
917
|
title: "Manual fields",
|
|
899
918
|
children: [
|
|
@@ -902,7 +921,7 @@ function Bt({
|
|
|
902
921
|
{
|
|
903
922
|
className: [
|
|
904
923
|
"h-1.5 w-1.5 rounded-full",
|
|
905
|
-
|
|
924
|
+
ke ? "bg-emerald-500" : "bg-slate-300 dark:bg-slate-600"
|
|
906
925
|
].join(" ")
|
|
907
926
|
}
|
|
908
927
|
),
|
|
@@ -910,81 +929,85 @@ function Bt({
|
|
|
910
929
|
]
|
|
911
930
|
}
|
|
912
931
|
)
|
|
913
|
-
] }) : void 0,
|
|
914
|
-
const
|
|
915
|
-
return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${
|
|
916
|
-
|
|
932
|
+
] }) : void 0, Ze = ve && ue && (E != null && E.length) ? /* @__PURE__ */ e("div", { className: "mt-2 rounded-lg border border-slate-200 bg-slate-50 dark:border-border dark:bg-slate-900/40 p-3", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: E.map((S) => {
|
|
933
|
+
const J = (le == null ? void 0 : le[S.field]) ?? 2;
|
|
934
|
+
return /* @__PURE__ */ e("div", { style: { gridColumn: `span ${J}` }, children: /* @__PURE__ */ e(
|
|
935
|
+
Be,
|
|
917
936
|
{
|
|
918
937
|
field: S,
|
|
919
938
|
draft: i,
|
|
920
939
|
onChange: u,
|
|
921
940
|
relations: l,
|
|
922
|
-
collection:
|
|
941
|
+
collection: a,
|
|
923
942
|
itemId: n,
|
|
924
|
-
error:
|
|
943
|
+
error: o[S.field],
|
|
925
944
|
visible: !0,
|
|
926
945
|
forceVisible: !0,
|
|
927
|
-
locked:
|
|
946
|
+
locked: f.has(S.field),
|
|
928
947
|
layoutAiEnabled: v,
|
|
929
948
|
renderField: h,
|
|
930
|
-
onCountChange:
|
|
949
|
+
onCountChange: m
|
|
931
950
|
}
|
|
932
951
|
) }, S.field);
|
|
933
|
-
}) }) }) : void 0
|
|
934
|
-
|
|
935
|
-
"div",
|
|
952
|
+
}) }) }) : void 0, De = /* @__PURE__ */ e(
|
|
953
|
+
Be,
|
|
936
954
|
{
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
955
|
+
field: y,
|
|
956
|
+
draft: i,
|
|
957
|
+
onChange: u,
|
|
958
|
+
relations: l,
|
|
959
|
+
collection: a,
|
|
960
|
+
itemId: n,
|
|
961
|
+
error: o[y.field],
|
|
962
|
+
visible: p.has(y.field) || !p.size,
|
|
963
|
+
forceVisible: Ne(y) || void 0,
|
|
964
|
+
locked: f.has(y.field),
|
|
965
|
+
layoutAiEnabled: v,
|
|
966
|
+
renderField: h,
|
|
967
|
+
onCountChange: m,
|
|
968
|
+
swapButton: Ae,
|
|
969
|
+
swapContent: Ze
|
|
970
|
+
}
|
|
971
|
+
);
|
|
972
|
+
return W(
|
|
973
|
+
{ kind: "field", field: y.field, group_key: t.key },
|
|
974
|
+
/* @__PURE__ */ N(
|
|
975
|
+
"div",
|
|
976
|
+
{
|
|
977
|
+
style: { gridColumn: `span ${Ue(y.options, xe)}` },
|
|
978
|
+
children: [
|
|
979
|
+
Ne(y) ? /* @__PURE__ */ e("div", { "data-design-hidden": "", className: "opacity-40", children: De }) : De,
|
|
980
|
+
(D == null ? void 0 : D.length) && _e && we && /* @__PURE__ */ e(
|
|
981
|
+
_t,
|
|
982
|
+
{
|
|
983
|
+
relCollection: we,
|
|
984
|
+
relId: z,
|
|
985
|
+
entries: D,
|
|
986
|
+
separator: X
|
|
987
|
+
}
|
|
988
|
+
)
|
|
989
|
+
]
|
|
990
|
+
},
|
|
991
|
+
y.field
|
|
992
|
+
)
|
|
970
993
|
);
|
|
971
994
|
}) });
|
|
972
995
|
})(),
|
|
973
|
-
|
|
996
|
+
A && /* @__PURE__ */ e("div", { className: "mt-4", children: A })
|
|
974
997
|
] })
|
|
975
998
|
]
|
|
976
999
|
}
|
|
977
1000
|
);
|
|
978
1001
|
}
|
|
979
1002
|
export {
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1003
|
+
Kt as GroupSection,
|
|
1004
|
+
_t as InlineDisplay,
|
|
1005
|
+
Ie as OwnersInline,
|
|
1006
|
+
Nt as OwnersInlineCompact,
|
|
1007
|
+
Q as RelationCell,
|
|
1008
|
+
zt as StripFieldValue,
|
|
1009
|
+
Ge as UserChip,
|
|
1010
|
+
Wt as UserRosterCluster,
|
|
1011
|
+
de as formatDisplayValue,
|
|
1012
|
+
St as useChangePulse
|
|
990
1013
|
};
|