@nivaro/react 0.3.53 → 0.3.54
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/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/ItemEditForm.js +3350 -3347
- package/dist/shared/components/PageRenderer.js +397 -396
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
- package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
- package/dist/shared/components/item-edit/SummaryPanel.js +358 -318
- package/dist/shared/components/item-edit/save-outcome.js +48 -0
- package/dist/shared/components/item-edit/stale-banner.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +116 -114
- package/dist/shared/lib/draft-store.js +35 -29
- package/dist/shared/lib/page-widget-access.js +11 -0
- package/package.json +1 -1
|
@@ -1,80 +1,78 @@
|
|
|
1
1
|
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { History as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useItemNavigation as
|
|
5
|
-
import {
|
|
6
|
-
|
|
2
|
+
import { History as T, ExternalLink as B, RotateCcw as E, Trash2 as F } from "lucide-react";
|
|
3
|
+
import { useState as w, useEffect as H } from "react";
|
|
4
|
+
import { useItemNavigation as I } from "../../context.js";
|
|
5
|
+
import { draftFilledBack as J } from "../../lib/draft-store.js";
|
|
6
|
+
import { formatRelative as y, titleCase as $ } from "../../lib/utils.js";
|
|
7
|
+
const j = (t) => {
|
|
7
8
|
if (t == null || t === "") return "empty";
|
|
8
9
|
if (typeof t == "boolean") return t ? "Yes" : "No";
|
|
9
|
-
const
|
|
10
|
-
return
|
|
10
|
+
const m = typeof t == "object" ? JSON.stringify(t) : String(t);
|
|
11
|
+
return m.length > 60 ? `${m.slice(0, 60)}…` : m;
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
+
function K({
|
|
13
14
|
draft: t,
|
|
14
|
-
labelFor:
|
|
15
|
-
current:
|
|
16
|
-
recordChanged:
|
|
17
|
-
onRestore:
|
|
18
|
-
onDiscard:
|
|
19
|
-
createdId:
|
|
15
|
+
labelFor: m,
|
|
16
|
+
current: v,
|
|
17
|
+
recordChanged: O,
|
|
18
|
+
onRestore: _,
|
|
19
|
+
onDiscard: C,
|
|
20
|
+
createdId: c = null,
|
|
20
21
|
collection: x,
|
|
21
22
|
renderValue: p
|
|
22
23
|
}) {
|
|
23
|
-
const [
|
|
24
|
-
|
|
25
|
-
const e = setInterval(() =>
|
|
24
|
+
const [N, R] = w(!1), [, S] = w(0);
|
|
25
|
+
H(() => {
|
|
26
|
+
const e = setInterval(() => S((r) => r + 1), 3e4);
|
|
26
27
|
return () => clearInterval(e);
|
|
27
28
|
}, []);
|
|
28
|
-
const
|
|
29
|
+
const k = I(), u = Object.entries(t.fields ?? {}), D = J(t), f = u.filter(([e]) => D.has(e)).length, b = u.length - f, h = c !== null, g = Object.values(t.pending_rows ?? {}).reduce((e, r) => e + r.length, 0), i = Object.values(t.pending_edits ?? {}).reduce(
|
|
29
30
|
(e, r) => e + Object.keys(r).length,
|
|
30
31
|
0
|
|
31
|
-
),
|
|
32
|
-
return b
|
|
32
|
+
), l = Object.values(t.pending_deletes ?? {}).reduce((e, r) => e + r.length, 0), o = Object.values(t.m2m_links ?? {}).reduce((e, r) => e + r.length, 0), d = Object.values(t.m2m_unlinks ?? {}).reduce((e, r) => e + r.length, 0), s = [];
|
|
33
|
+
return b && s.push(`${b} field${b === 1 ? "" : "s"}`), f && s.push(`${f} filled in from ${b === 1 ? "it" : "them"}`), g && s.push(`${g} new line${g === 1 ? "" : "s"}`), i && s.push(`${i} line edit${i === 1 ? "" : "s"}`), l && s.push(`${l} line removal${l === 1 ? "" : "s"}`), o && s.push(`${o} link${o === 1 ? "" : "s"}`), d && s.push(`${d} unlink${d === 1 ? "" : "s"}`), /* @__PURE__ */ a(
|
|
33
34
|
"div",
|
|
34
35
|
{
|
|
35
36
|
className: "mb-2 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-[12.5px] text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200",
|
|
36
37
|
"data-nvr-draft-recovery": !0,
|
|
37
38
|
children: [
|
|
38
39
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
39
|
-
/* @__PURE__ */ n(
|
|
40
|
+
/* @__PURE__ */ n(T, { className: "h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400" }),
|
|
40
41
|
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
|
|
41
42
|
h ? /* @__PURE__ */ a("span", { className: "font-semibold", "data-nvr-draft-created": !0, children: [
|
|
42
43
|
"These changes from ",
|
|
43
|
-
|
|
44
|
-
" were already saved"
|
|
45
|
-
s ? ` as record ${s}` : " as a new record",
|
|
46
|
-
" — restoring them makes a second one."
|
|
44
|
+
y(t.saved_at),
|
|
45
|
+
" were already saved as a new record — restoring them makes a second one."
|
|
47
46
|
] }) : /* @__PURE__ */ a("span", { className: "font-semibold", children: [
|
|
48
47
|
"Restore your unsaved changes from ",
|
|
49
|
-
|
|
48
|
+
y(t.saved_at),
|
|
50
49
|
"?"
|
|
51
50
|
] }),
|
|
52
51
|
" ",
|
|
53
|
-
/* @__PURE__ */ n("span", { className: "text-amber-800/80 dark:text-amber-200/80", children:
|
|
54
|
-
|
|
52
|
+
/* @__PURE__ */ n("span", { className: "text-amber-800/80 dark:text-amber-200/80", children: s.join(" · ") }),
|
|
53
|
+
O && /* @__PURE__ */ n("span", { className: "ml-1 rounded bg-amber-200/70 px-1 py-px text-[10.5px] font-semibold uppercase tracking-wide text-amber-900 dark:bg-amber-500/30 dark:text-amber-100", children: "record changed since — review before restoring" })
|
|
55
54
|
] }),
|
|
56
55
|
/* @__PURE__ */ n(
|
|
57
56
|
"button",
|
|
58
57
|
{
|
|
59
58
|
type: "button",
|
|
60
|
-
onClick: () =>
|
|
59
|
+
onClick: () => R((e) => !e),
|
|
61
60
|
className: "text-[11.5px] underline decoration-dotted underline-offset-2",
|
|
62
|
-
children:
|
|
61
|
+
children: N ? "Hide changes" : "Show changes"
|
|
63
62
|
}
|
|
64
63
|
),
|
|
65
|
-
h &&
|
|
64
|
+
h && c && x && /* @__PURE__ */ a(
|
|
66
65
|
"a",
|
|
67
66
|
{
|
|
68
|
-
href:
|
|
67
|
+
href: k.urlFor({ collection: x, itemId: c }),
|
|
69
68
|
onClick: (e) => {
|
|
70
|
-
e.preventDefault(),
|
|
69
|
+
e.preventDefault(), k.open({ collection: x, itemId: c });
|
|
71
70
|
},
|
|
72
71
|
className: "inline-flex h-7 items-center gap-1 rounded-md bg-amber-600 px-2.5 text-[11.5px] font-semibold text-white hover:bg-amber-700",
|
|
73
72
|
"data-nvr-draft-open-created": !0,
|
|
74
73
|
children: [
|
|
75
|
-
/* @__PURE__ */ n(
|
|
76
|
-
" Open record
|
|
77
|
-
s
|
|
74
|
+
/* @__PURE__ */ n(B, { className: "h-3 w-3" }),
|
|
75
|
+
" Open the record"
|
|
78
76
|
]
|
|
79
77
|
}
|
|
80
78
|
),
|
|
@@ -82,11 +80,11 @@ function q({
|
|
|
82
80
|
"button",
|
|
83
81
|
{
|
|
84
82
|
type: "button",
|
|
85
|
-
onClick:
|
|
83
|
+
onClick: _,
|
|
86
84
|
className: h ? "inline-flex h-7 items-center gap-1 rounded-md border border-amber-300 px-2.5 text-[11.5px] font-medium hover:bg-amber-100 dark:border-amber-500/40 dark:hover:bg-amber-500/15" : "inline-flex h-7 items-center gap-1 rounded-md bg-amber-600 px-2.5 text-[11.5px] font-semibold text-white hover:bg-amber-700",
|
|
87
85
|
"data-nvr-draft-restore": !0,
|
|
88
86
|
children: [
|
|
89
|
-
/* @__PURE__ */ n(
|
|
87
|
+
/* @__PURE__ */ n(E, { className: "h-3 w-3" }),
|
|
90
88
|
" ",
|
|
91
89
|
h ? "Restore anyway" : "Restore"
|
|
92
90
|
]
|
|
@@ -96,23 +94,23 @@ function q({
|
|
|
96
94
|
"button",
|
|
97
95
|
{
|
|
98
96
|
type: "button",
|
|
99
|
-
onClick:
|
|
97
|
+
onClick: C,
|
|
100
98
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-amber-300 px-2.5 text-[11.5px] font-medium hover:bg-amber-100 dark:border-amber-500/40 dark:hover:bg-amber-500/15",
|
|
101
99
|
"data-nvr-draft-discard": !0,
|
|
102
100
|
children: [
|
|
103
|
-
/* @__PURE__ */ n(
|
|
101
|
+
/* @__PURE__ */ n(F, { className: "h-3 w-3" }),
|
|
104
102
|
" Discard"
|
|
105
103
|
]
|
|
106
104
|
}
|
|
107
105
|
)
|
|
108
106
|
] }),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/* @__PURE__ */ n("span", { className: "font-medium", children:
|
|
107
|
+
N && /* @__PURE__ */ a("div", { className: "mt-2 max-h-[240px] space-y-1 overflow-y-auto border-t border-amber-200/70 pt-2 dark:border-amber-500/30", children: [
|
|
108
|
+
u.map(([e, r]) => /* @__PURE__ */ a("div", { className: "text-[11.5px]", children: [
|
|
109
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: m(e) || $(e.replace(/_/g, " ")) }),
|
|
112
110
|
/* @__PURE__ */ a("p", { className: "break-words text-amber-800/80 dark:text-amber-200/80", children: [
|
|
113
|
-
/* @__PURE__ */ n("span", { className: "line-through opacity-70", children: p ? p(e,
|
|
111
|
+
/* @__PURE__ */ n("span", { className: "line-through opacity-70", children: p ? p(e, v[e]) : j(v[e]) }),
|
|
114
112
|
" ",
|
|
115
|
-
/* @__PURE__ */ n("span", { className: "font-medium text-amber-900 dark:text-amber-100", children: p ? p(e, r) :
|
|
113
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-amber-900 dark:text-amber-100", children: p ? p(e, r) : j(r) })
|
|
116
114
|
] })
|
|
117
115
|
] }, e)),
|
|
118
116
|
Object.entries(t.pending_rows ?? {}).filter(([, e]) => e.length > 0).map(([e, r]) => /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
@@ -121,22 +119,22 @@ function q({
|
|
|
121
119
|
r.length === 1 ? "" : "s",
|
|
122
120
|
" in",
|
|
123
121
|
" ",
|
|
124
|
-
|
|
122
|
+
$(e.split(".")[0].replace(/_/g, " "))
|
|
125
123
|
] }, e)),
|
|
124
|
+
i > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
125
|
+
i,
|
|
126
|
+
" edited line",
|
|
127
|
+
i === 1 ? "" : "s"
|
|
128
|
+
] }),
|
|
126
129
|
l > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
127
130
|
l,
|
|
128
|
-
"
|
|
131
|
+
" line removal",
|
|
129
132
|
l === 1 ? "" : "s"
|
|
130
133
|
] }),
|
|
131
134
|
o > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
132
135
|
o,
|
|
133
|
-
" line removal",
|
|
134
|
-
o === 1 ? "" : "s"
|
|
135
|
-
] }),
|
|
136
|
-
m > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
137
|
-
m,
|
|
138
136
|
" relation link",
|
|
139
|
-
|
|
137
|
+
o === 1 ? "" : "s"
|
|
140
138
|
] }),
|
|
141
139
|
d > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
142
140
|
d,
|
|
@@ -149,5 +147,5 @@ function q({
|
|
|
149
147
|
);
|
|
150
148
|
}
|
|
151
149
|
export {
|
|
152
|
-
|
|
150
|
+
K as DraftRecoveryBanner
|
|
153
151
|
};
|
|
@@ -4,18 +4,19 @@ import { useState as F, Fragment as P, useInsertionEffect as T } from "react";
|
|
|
4
4
|
import { toast as h } from "sonner";
|
|
5
5
|
import { plainErrorText as I, userErrorMessage as R } from "../../lib/safe-error.js";
|
|
6
6
|
import { usePersonalDefaultsApi as D } from "./usePersonalDefaults.js";
|
|
7
|
-
function
|
|
8
|
-
return e.applied && e.hasDefault ? "applied" : e.editable ? e.loaded ? e.failed && !e.hasDefault ? e.hasValue ? "offer" : null : e.hasDefault ? e.hasValue ? e.isDefault ? "saved" : "update" : "saved-empty" : e.hasValue ? "offer" : "reserve" :
|
|
7
|
+
function V(e) {
|
|
8
|
+
return e.applied && e.hasDefault ? "applied" : e.editable ? !e.loaded || e.held && !e.hasValue ? "reserve" : e.failed && !e.hasDefault ? e.hasValue ? "offer" : null : e.hasDefault ? e.hasValue ? e.isDefault ? "saved" : "update" : "saved-empty" : e.hasValue ? "offer" : "reserve" : null;
|
|
9
9
|
}
|
|
10
10
|
function q(e, t, a) {
|
|
11
|
-
return e != null && e.allowed(t) ? e.manageable(t) ?
|
|
11
|
+
return e != null && e.allowed(t) ? e.manageable(t) ? V({
|
|
12
12
|
editable: a,
|
|
13
13
|
loaded: e.loaded,
|
|
14
14
|
hasValue: e.hasValue(t),
|
|
15
15
|
hasDefault: e.defaultFor(t) !== null,
|
|
16
16
|
isDefault: e.isDefault(t),
|
|
17
17
|
applied: e.applied(t),
|
|
18
|
-
failed: e.failed
|
|
18
|
+
failed: e.failed,
|
|
19
|
+
held: e.held === !0
|
|
19
20
|
}) : e.applied(t) && e.defaultFor(t) !== null ? "applied" : null : null;
|
|
20
21
|
}
|
|
21
22
|
function g(e, t) {
|
|
@@ -23,7 +24,7 @@ function g(e, t) {
|
|
|
23
24
|
const a = e, d = ((p = (s = a == null ? void 0 : a.response) == null ? void 0 : s.data) == null ? void 0 : p.error) ?? ((o = a == null ? void 0 : a.data) == null ? void 0 : o.error) ?? (a == null ? void 0 : a.error);
|
|
24
25
|
return typeof d == "string" ? I(d, t) : R(e, t);
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function A(e, t) {
|
|
27
28
|
return e.clear(t).then(
|
|
28
29
|
(a) => (h.success(
|
|
29
30
|
"Your default was cleared",
|
|
@@ -42,7 +43,7 @@ function L(e, t) {
|
|
|
42
43
|
(a) => (h.error(g(a, "Could not clear your default")), !1)
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
+
const L = `
|
|
46
47
|
[data-pd-row]{container-type:inline-size;container-name:nvrpd}
|
|
47
48
|
[data-personal-default-slot]{min-width:13rem}
|
|
48
49
|
[data-personal-default-slot][data-pd-new]{min-width:16rem}
|
|
@@ -69,7 +70,7 @@ function $() {
|
|
|
69
70
|
T(() => {
|
|
70
71
|
if (typeof document > "u" || document.getElementById(N)) return;
|
|
71
72
|
const e = document.createElement("style");
|
|
72
|
-
e.id = N, e.textContent =
|
|
73
|
+
e.id = N, e.textContent = L, document.head.appendChild(e);
|
|
73
74
|
}, []);
|
|
74
75
|
}
|
|
75
76
|
const y = 'relative inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded px-1 text-[10.5px] font-medium text-slate-500 transition-colors duration-150 before:absolute before:inset-x-0 before:-inset-y-0.5 before:content-[""] hover:bg-muted hover:text-slate-800 active:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-600 disabled:cursor-not-allowed disabled:opacity-50 aria-expanded:bg-muted aria-expanded:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground dark:focus-visible:ring-sky-300 dark:aria-expanded:text-foreground', M = "inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap px-1 text-[10.5px] font-medium text-slate-500 dark:text-muted-foreground", j = "inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded bg-sky-50 px-1.5 text-[10.5px] font-medium text-sky-800 dark:bg-sky-900/30 dark:text-sky-200";
|
|
@@ -105,7 +106,7 @@ function G({
|
|
|
105
106
|
disabled: x || !l,
|
|
106
107
|
"aria-busy": x || void 0,
|
|
107
108
|
onClick: () => {
|
|
108
|
-
l && (b(!0),
|
|
109
|
+
l && (b(!0), A(l, e).then((n) => {
|
|
109
110
|
b(!1), n && (o == null || o());
|
|
110
111
|
}));
|
|
111
112
|
},
|
|
@@ -218,12 +219,12 @@ function H({ field: e }) {
|
|
|
218
219
|
);
|
|
219
220
|
}
|
|
220
221
|
export {
|
|
221
|
-
|
|
222
|
+
L as PERSONAL_DEFAULT_CSS,
|
|
222
223
|
H as PersonalDefaultMark,
|
|
223
224
|
G as PersonalDefaultSlot,
|
|
224
|
-
|
|
225
|
+
A as clearPersonalDefault,
|
|
225
226
|
q as personalDefaultSlotFor,
|
|
226
|
-
|
|
227
|
+
V as personalDefaultSlotState,
|
|
227
228
|
g as refusalText,
|
|
228
229
|
$ as usePersonalDefaultCss
|
|
229
230
|
};
|
|
@@ -26,7 +26,7 @@ function lt(n) {
|
|
|
26
26
|
d({ x: p.left, y: m ? p.top - 58 : p.bottom + 4 });
|
|
27
27
|
},
|
|
28
28
|
onMouseLeave: () => d(null)
|
|
29
|
-
},
|
|
29
|
+
}, _ = n && r ? je(
|
|
30
30
|
/* @__PURE__ */ s(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
@@ -37,7 +37,7 @@ function lt(n) {
|
|
|
37
37
|
),
|
|
38
38
|
document.body
|
|
39
39
|
) : null;
|
|
40
|
-
return { bind: y, tip:
|
|
40
|
+
return { bind: y, tip: _ };
|
|
41
41
|
}
|
|
42
42
|
function Le(n, r) {
|
|
43
43
|
return n == null || n === "" || r == null || r === "" ? !1 : String(n) === String(r);
|
|
@@ -47,7 +47,7 @@ function dt({
|
|
|
47
47
|
value: r,
|
|
48
48
|
onChange: d,
|
|
49
49
|
disabled: y,
|
|
50
|
-
placeholder:
|
|
50
|
+
placeholder: _,
|
|
51
51
|
extraFilter: g,
|
|
52
52
|
autoSelectSingle: p,
|
|
53
53
|
optionSort: m,
|
|
@@ -56,7 +56,7 @@ function dt({
|
|
|
56
56
|
fieldKey: C,
|
|
57
57
|
narrowedBy: a,
|
|
58
58
|
pinned: f,
|
|
59
|
-
missPlacement:
|
|
59
|
+
missPlacement: q,
|
|
60
60
|
defaultOpen: Fe,
|
|
61
61
|
onClose: le
|
|
62
62
|
}) {
|
|
@@ -93,16 +93,16 @@ function dt({
|
|
|
93
93
|
if (!i) return;
|
|
94
94
|
const t = i.getBoundingClientRect(), l = i.closest('[role="dialog"]') ?? document.body;
|
|
95
95
|
Oe(l);
|
|
96
|
-
const Ne = window.innerHeight - t.bottom < 340 && t.top > window.innerHeight - t.bottom, ke = t.left, Se = Ne ? t.top - 4 : t.bottom + 4,
|
|
96
|
+
const Ne = window.innerHeight - t.bottom < 340 && t.top > window.innerHeight - t.bottom, ke = t.left, Se = Ne ? t.top - 4 : t.bottom + 4, _e = {
|
|
97
97
|
minWidth: t.width,
|
|
98
98
|
zIndex: 120,
|
|
99
99
|
...Ne ? { transform: "translateY(-100%)" } : {}
|
|
100
100
|
};
|
|
101
101
|
if (l === document.body)
|
|
102
|
-
ee({ position: "fixed", left: ke, top: Se, ...
|
|
102
|
+
ee({ position: "fixed", left: ke, top: Se, ..._e });
|
|
103
103
|
else {
|
|
104
|
-
const
|
|
105
|
-
ee({ position: "absolute", left: ke -
|
|
104
|
+
const qe = l.getBoundingClientRect();
|
|
105
|
+
ee({ position: "absolute", left: ke - qe.left, top: Se - qe.top, ..._e });
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
@@ -184,7 +184,7 @@ function dt({
|
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
186
|
j(() => Ee(O), [O]), st({
|
|
187
|
-
placement:
|
|
187
|
+
placement: q,
|
|
188
188
|
open: c,
|
|
189
189
|
search: L,
|
|
190
190
|
settled: !O && !be && h !== void 0,
|
|
@@ -244,7 +244,10 @@ function dt({
|
|
|
244
244
|
() => ot(
|
|
245
245
|
h ?? [],
|
|
246
246
|
(e) => k(w, e) || `#${e.id}`,
|
|
247
|
-
|
|
247
|
+
// The server also reads a joined code by its parts ("2026-NNO-POWER"
|
|
248
|
+
// finds 2026-WEST-NNO-HE-POWERING, services/search-synonyms.ts), so
|
|
249
|
+
// the list narrowed while that search is out does too.
|
|
250
|
+
v.replace(/[-_/]+/g, " "),
|
|
248
251
|
ie
|
|
249
252
|
),
|
|
250
253
|
[h, w, v, ie]
|
|
@@ -321,7 +324,7 @@ function dt({
|
|
|
321
324
|
),
|
|
322
325
|
children: [
|
|
323
326
|
M && /* @__PURE__ */ s(ze, { className: "h-3.5 w-3.5 shrink-0 text-amber-500" }),
|
|
324
|
-
/* @__PURE__ */ s("span", { className: "truncate", children: ye ??
|
|
327
|
+
/* @__PURE__ */ s("span", { className: "truncate", children: ye ?? _ ?? "Select…" })
|
|
325
328
|
]
|
|
326
329
|
}
|
|
327
330
|
),
|
|
@@ -525,24 +528,24 @@ function ct({
|
|
|
525
528
|
search: r,
|
|
526
529
|
filter: d,
|
|
527
530
|
narrowedLabels: y,
|
|
528
|
-
auto:
|
|
531
|
+
auto: _
|
|
529
532
|
}) {
|
|
530
533
|
const g = ae(), [p, m] = $(!1), F = d ? JSON.stringify(d) : "", { data: o, isFetching: C } = S({
|
|
531
534
|
queryKey: ["picker-narrowing", n, r, F],
|
|
532
535
|
queryFn: () => g.request(
|
|
533
536
|
Ve("/picker-narrowing", { collection: n, search: r, filter: d ?? null })
|
|
534
|
-
).then((
|
|
535
|
-
enabled: p ||
|
|
537
|
+
).then((q) => q.data),
|
|
538
|
+
enabled: p || _,
|
|
536
539
|
staleTime: 3e4,
|
|
537
540
|
retry: !1
|
|
538
541
|
});
|
|
539
|
-
if (!p && !
|
|
542
|
+
if (!p && !_)
|
|
540
543
|
return /* @__PURE__ */ s(
|
|
541
544
|
"button",
|
|
542
545
|
{
|
|
543
546
|
type: "button",
|
|
544
|
-
onClick: (
|
|
545
|
-
|
|
547
|
+
onClick: (q) => {
|
|
548
|
+
q.stopPropagation(), m(!0);
|
|
546
549
|
},
|
|
547
550
|
className: "w-full border-t border-border px-3 py-1.5 text-left text-[11px] text-muted-foreground hover:text-foreground",
|
|
548
551
|
"data-picker-narrowing-ask": !0,
|
|
@@ -566,7 +569,7 @@ function ct({
|
|
|
566
569
|
"data-picker-narrowing": !0,
|
|
567
570
|
"data-picker-narrowing-field": o.by_field_filter,
|
|
568
571
|
"data-picker-narrowing-excluded": o.by_exclusions,
|
|
569
|
-
children: a.map((
|
|
572
|
+
children: a.map((q) => /* @__PURE__ */ s("p", { children: q }, q))
|
|
570
573
|
}
|
|
571
574
|
);
|
|
572
575
|
}
|
|
@@ -575,7 +578,7 @@ function Ct({
|
|
|
575
578
|
id: r,
|
|
576
579
|
displayTemplate: d
|
|
577
580
|
}) {
|
|
578
|
-
const y = ae(),
|
|
581
|
+
const y = ae(), _ = Re(), g = n === "nivaro_files" || n === "directus_files", p = (() => {
|
|
579
582
|
if (!d || !d.includes(".")) return null;
|
|
580
583
|
const o = [...d.matchAll(/\{\{([^}]+)\}\}/g)].map((C) => C[1].trim());
|
|
581
584
|
return o.length > 0 ? ["id", ...o].join(",") : null;
|
|
@@ -588,7 +591,7 @@ function Ct({
|
|
|
588
591
|
y.request(
|
|
589
592
|
R(`/files/${encodeURIComponent(String(r))}/meta`)
|
|
590
593
|
).then((o) => o.data)
|
|
591
|
-
) :
|
|
594
|
+
) : _(n, r, p),
|
|
592
595
|
enabled: !!r && !!n,
|
|
593
596
|
staleTime: 6e4
|
|
594
597
|
});
|