@nivaro/react 0.3.24 → 0.3.25

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.
@@ -1,13 +1,13 @@
1
- import { jsx as t, jsxs as a, Fragment as U } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as a, Fragment as L } from "react/jsx-runtime";
2
2
  import { useQueryClient as ae, useQuery as Y } from "@tanstack/react-query";
3
- import { Loader2 as ie, X as W, ChevronRight as le } from "lucide-react";
4
- import { useState as k, useMemo as Z } from "react";
5
- import { useNivaroClient as de } from "../../context.js";
6
- import { get as V, patch as oe, del as ce, post as pe } from "../../lib/commands.js";
7
- import { titleCase as G, cn as ue, toLocalDateString as me } from "../../lib/utils.js";
8
- import { useAddendumO2M as xe, useAddendumView as he } from "./AddendumFieldContext.js";
9
- import { useO2MStaging as be } from "./O2MStagingContext.js";
10
- const fe = /* @__PURE__ */ new Set([
3
+ import { Loader2 as ie, X as U, ChevronRight as le } from "lucide-react";
4
+ import { memo as de, useState as k, useMemo as W } from "react";
5
+ import { useNivaroClient as oe } from "../../context.js";
6
+ import { get as G, patch as ce, del as pe, post as ue } from "../../lib/commands.js";
7
+ import { titleCase as V, cn as me, toLocalDateString as xe } from "../../lib/utils.js";
8
+ import { useAddendumO2M as he, useAddendumView as be } from "./AddendumFieldContext.js";
9
+ import { useO2MStaging as fe } from "./O2MStagingContext.js";
10
+ const ye = /* @__PURE__ */ new Set([
11
11
  "alias",
12
12
  "o2m",
13
13
  "m2m",
@@ -15,30 +15,29 @@ const fe = /* @__PURE__ */ new Set([
15
15
  "presentation",
16
16
  "group",
17
17
  "divider"
18
- ]);
19
- function Ee({
18
+ ]), $e = de(function({
20
19
  relatedCollection: l,
21
20
  manyField: c,
22
21
  parentId: m,
23
22
  layoutSlug: b,
24
- parentFieldKey: F,
23
+ parentFieldKey: Z,
25
24
  emptyLabel: S
26
25
  }) {
27
- var L;
28
- const f = de(), _ = ae(), x = be(), d = m === "new", B = xe()[F ?? ""] ?? [], [q, C] = k(null), [D, I] = k({}), [E, v] = k(!1), [R, y] = k({}), [g, $] = k(!1), N = he(), { data: u } = Y({
26
+ var H;
27
+ const f = oe(), Q = ae(), x = fe(), d = m === "new", B = he()[Z ?? ""] ?? [], [q, C] = k(null), [_, D] = k({}), [E, v] = k(!1), [R, y] = k({}), [g, $] = k(!1), N = be(), { data: u } = Y({
29
28
  queryKey: ["active-layout", l, b ?? null],
30
29
  queryFn: () => f.request(
31
- V("/collection-layouts/active", {
30
+ G("/collection-layouts/active", {
32
31
  collection: l,
33
32
  ...b ? { slug: b } : {}
34
33
  })
35
34
  ).then((e) => e.data).catch(() => null),
36
35
  staleTime: 6e4,
37
36
  enabled: !!b
38
- }), T = b ? ((L = u == null ? void 0 : u.layout) == null ? void 0 : L.id) ?? null : null, { data: ee = [] } = Y({
37
+ }), T = b ? ((H = u == null ? void 0 : u.layout) == null ? void 0 : H.id) ?? null : null, { data: ee = [] } = Y({
39
38
  queryKey: ["field-config", l, T],
40
39
  queryFn: () => f.request(
41
- V(
40
+ G(
42
41
  `/field-config/${l}`,
43
42
  T ? { layout_id: String(T) } : void 0
44
43
  )
@@ -48,7 +47,7 @@ function Ee({
48
47
  }), { data: w = [], isLoading: te } = Y({
49
48
  queryKey: ["o2m-rows", l, c, m],
50
49
  queryFn: () => f.request(
51
- V(`/items/${l}`, {
50
+ G(`/items/${l}`, {
52
51
  filter: JSON.stringify({ [c]: { _eq: m } }),
53
52
  limit: 200
54
53
  })
@@ -56,23 +55,23 @@ function Ee({
56
55
  enabled: !d,
57
56
  staleTime: 3e4
58
57
  }), J = d && x ? x.getPendingRows(l, c) : [], o = ee.filter(
59
- (e) => !e.hidden && !fe.has(e.type) && e.field !== c && e.field !== "id"
60
- ), A = Z(
61
- () => ((u == null ? void 0 : u.groups) ?? []).filter((e) => e.type === "section").sort((e, r) => e.sort - r.sort),
58
+ (e) => !e.hidden && !ye.has(e.type) && e.field !== c && e.field !== "id"
59
+ ), A = W(
60
+ () => ((u == null ? void 0 : u.groups) ?? []).filter((e) => e.type === "section").sort((e, n) => e.sort - n.sort),
62
61
  [u]
63
- ), h = Z(() => {
62
+ ), h = W(() => {
64
63
  if (!A.length) return null;
65
64
  const e = /* @__PURE__ */ new Map();
66
- for (const r of o) {
67
- const n = r.group_key ?? null;
68
- e.has(n) || e.set(n, []), e.get(n).push(r);
65
+ for (const n of o) {
66
+ const r = n.group_key ?? null;
67
+ e.has(r) || e.set(r, []), e.get(r).push(n);
69
68
  }
70
69
  return e;
71
70
  }, [o, A]);
72
71
  async function X(e) {
73
72
  $(!0);
74
73
  try {
75
- await f.request(oe(`/items/${l}/${e}`, D)), _.invalidateQueries({ queryKey: ["o2m-rows", l, c, m] }), C(null);
74
+ await f.request(ce(`/items/${l}/${e}`, _)), Q.invalidateQueries({ queryKey: ["o2m-rows", l, c, m] }), C(null);
76
75
  } catch {
77
76
  } finally {
78
77
  $(!1);
@@ -86,38 +85,38 @@ function Ee({
86
85
  $(!0);
87
86
  try {
88
87
  await f.request(
89
- pe(`/items/${l}`, { ...R, [c]: m })
90
- ), _.invalidateQueries({ queryKey: ["o2m-rows", l, c, m] }), v(!1), y({});
88
+ ue(`/items/${l}`, { ...R, [c]: m })
89
+ ), Q.invalidateQueries({ queryKey: ["o2m-rows", l, c, m] }), v(!1), y({});
91
90
  } catch {
92
91
  } finally {
93
92
  $(!1);
94
93
  }
95
94
  }
96
- async function re(e) {
95
+ async function ne(e) {
97
96
  try {
98
- await f.request(ce(`/items/${l}/${e}`)), _.invalidateQueries({ queryKey: ["o2m-rows", l, c, m] });
97
+ await f.request(pe(`/items/${l}/${e}`)), Q.invalidateQueries({ queryKey: ["o2m-rows", l, c, m] });
99
98
  } catch {
100
99
  }
101
100
  }
102
- function K(e, r) {
103
- if (r == null) return /* @__PURE__ */ t("span", { className: "text-slate-300", children: "—" });
101
+ function K(e, n) {
102
+ if (n == null) return /* @__PURE__ */ t("span", { className: "text-slate-300", children: "—" });
104
103
  if (e.type === "boolean")
105
- return /* @__PURE__ */ t("span", { className: r ? "text-emerald-600" : "text-slate-400", children: r ? "Yes" : "No" });
104
+ return /* @__PURE__ */ t("span", { className: n ? "text-emerald-600" : "text-slate-400", children: n ? "Yes" : "No" });
106
105
  if (e.type === "datetime" || e.type === "date")
107
106
  try {
108
- return /* @__PURE__ */ t("span", { children: me(r) });
107
+ return /* @__PURE__ */ t("span", { children: xe(n) });
109
108
  } catch {
110
109
  }
111
- return /* @__PURE__ */ t("span", { className: "truncate", children: String(r) });
110
+ return /* @__PURE__ */ t("span", { className: "truncate", children: String(n) });
112
111
  }
113
- function O(e, r, n) {
114
- const s = r[e.field] ?? "";
112
+ function O(e, n, r) {
113
+ const s = n[e.field] ?? "";
115
114
  return e.type === "boolean" ? /* @__PURE__ */ t(
116
115
  "input",
117
116
  {
118
117
  type: "checkbox",
119
118
  checked: !!s,
120
- onChange: (i) => n(e.field, i.target.checked),
119
+ onChange: (i) => r(e.field, i.target.checked),
121
120
  className: "h-4 w-4"
122
121
  }
123
122
  ) : e.type === "integer" || e.type === "bigInteger" || e.type === "float" || e.type === "decimal" ? /* @__PURE__ */ t(
@@ -125,7 +124,7 @@ function Ee({
125
124
  {
126
125
  type: "number",
127
126
  value: String(s),
128
- onChange: (i) => n(e.field, i.target.value === "" ? null : Number(i.target.value)),
127
+ onChange: (i) => r(e.field, i.target.value === "" ? null : Number(i.target.value)),
129
128
  className: "w-full rounded border border-slate-200 px-2 py-1.5 text-[12px] focus:outline-none focus:border-nvr-cyan"
130
129
  }
131
130
  ) : e.type === "date" ? /* @__PURE__ */ t(
@@ -133,7 +132,7 @@ function Ee({
133
132
  {
134
133
  type: "date",
135
134
  value: String(s).slice(0, 10),
136
- onChange: (i) => n(e.field, i.target.value || null),
135
+ onChange: (i) => r(e.field, i.target.value || null),
137
136
  className: "w-full rounded border border-slate-200 px-2 py-1.5 text-[12px] focus:outline-none focus:border-nvr-cyan"
138
137
  }
139
138
  ) : e.type === "datetime" ? /* @__PURE__ */ t(
@@ -141,7 +140,7 @@ function Ee({
141
140
  {
142
141
  type: "datetime-local",
143
142
  value: String(s).slice(0, 16),
144
- onChange: (i) => n(e.field, i.target.value ? new Date(i.target.value).toISOString() : null),
143
+ onChange: (i) => r(e.field, i.target.value ? new Date(i.target.value).toISOString() : null),
145
144
  className: "w-full rounded border border-slate-200 px-2 py-1.5 text-[12px] focus:outline-none focus:border-nvr-cyan"
146
145
  }
147
146
  ) : /* @__PURE__ */ t(
@@ -149,13 +148,13 @@ function Ee({
149
148
  {
150
149
  type: "text",
151
150
  value: String(s),
152
- onChange: (i) => n(e.field, i.target.value),
151
+ onChange: (i) => r(e.field, i.target.value),
153
152
  className: "w-full rounded border border-slate-200 px-2 py-1.5 text-[12px] focus:outline-none focus:border-nvr-cyan"
154
153
  }
155
154
  );
156
155
  }
157
- function H(e, r, n, s, i) {
158
- const M = (h == null ? void 0 : h.get(null)) ?? [];
156
+ function F(e, n, r, s, i) {
157
+ const I = (h == null ? void 0 : h.get(null)) ?? [];
159
158
  return /* @__PURE__ */ a("div", { className: "border border-slate-200 rounded-lg bg-white overflow-hidden", children: [
160
159
  /* @__PURE__ */ a("div", { className: "flex items-center justify-between border-b border-slate-100 px-3 py-2 bg-slate-50", children: [
161
160
  /* @__PURE__ */ t("span", { className: "text-[11px] font-semibold text-slate-600 uppercase tracking-wide", children: i }),
@@ -174,7 +173,7 @@ function Ee({
174
173
  {
175
174
  type: "button",
176
175
  disabled: g,
177
- onClick: n,
176
+ onClick: r,
178
177
  className: "text-[11px] font-medium bg-nvr-cyan text-white px-2.5 py-0.5 rounded hover:brightness-110 disabled:opacity-50",
179
178
  children: g ? "…" : "Save"
180
179
  }
@@ -182,25 +181,25 @@ function Ee({
182
181
  ] })
183
182
  ] }),
184
183
  /* @__PURE__ */ a("div", { className: "p-3 space-y-4", children: [
185
- M.length > 0 && /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-x-4 gap-y-2", children: M.map((p) => /* @__PURE__ */ a("div", { children: [
186
- /* @__PURE__ */ t("label", { className: "block text-[11px] font-medium text-slate-500 mb-1", children: p.label ?? G(p.field) }),
187
- O(p, e, r)
184
+ I.length > 0 && /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-x-4 gap-y-2", children: I.map((p) => /* @__PURE__ */ a("div", { children: [
185
+ /* @__PURE__ */ t("label", { className: "block text-[11px] font-medium text-slate-500 mb-1", children: p.label ?? V(p.field) }),
186
+ O(p, e, n)
188
187
  ] }, p.field)) }),
189
188
  A.map((p) => {
190
- const P = (h == null ? void 0 : h.get(p.key)) ?? [];
191
- return P.length ? /* @__PURE__ */ a("div", { children: [
189
+ const M = (h == null ? void 0 : h.get(p.key)) ?? [];
190
+ return M.length ? /* @__PURE__ */ a("div", { children: [
192
191
  /* @__PURE__ */ t("div", { className: "text-[10px] font-semibold uppercase tracking-wider text-slate-400 mb-2 pb-1 border-b border-slate-100", children: p.label }),
193
- /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-x-4 gap-y-2", children: P.map((Q) => /* @__PURE__ */ a("div", { children: [
194
- /* @__PURE__ */ t("label", { className: "block text-[11px] font-medium text-slate-500 mb-1", children: Q.label ?? G(Q.field) }),
195
- O(Q, e, r)
196
- ] }, Q.field)) })
192
+ /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-x-4 gap-y-2", children: M.map((P) => /* @__PURE__ */ a("div", { children: [
193
+ /* @__PURE__ */ t("label", { className: "block text-[11px] font-medium text-slate-500 mb-1", children: P.label ?? V(P.field) }),
194
+ O(P, e, n)
195
+ ] }, P.field)) })
197
196
  ] }, p.key) : null;
198
197
  })
199
198
  ] })
200
199
  ] });
201
200
  }
202
- function ne(e, r) {
203
- return o.map((n) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5", children: O(n, e, r) }, n.field));
201
+ function re(e, n) {
202
+ return o.map((r) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5", children: O(r, e, n) }, r.field));
204
203
  }
205
204
  if (!d && te)
206
205
  return /* @__PURE__ */ t("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ t(ie, { className: "h-4 w-4 animate-spin inline" }) });
@@ -217,48 +216,48 @@ function Ee({
217
216
  "th",
218
217
  {
219
218
  className: "px-3 py-2 text-left font-medium text-slate-500 text-[11px]",
220
- children: e.label ?? G(e.field)
219
+ children: e.label ?? V(e.field)
221
220
  },
222
221
  e.field
223
222
  )),
224
223
  /* @__PURE__ */ t("th", { className: "w-16" })
225
224
  ] }) }),
226
225
  /* @__PURE__ */ a("tbody", { children: [
227
- d && J.map((e, r) => /* @__PURE__ */ a("tr", { className: "border-b border-slate-100 bg-amber-50/40", children: [
226
+ d && J.map((e, n) => /* @__PURE__ */ a("tr", { className: "border-b border-slate-100 bg-amber-50/40", children: [
228
227
  /* @__PURE__ */ t("td", { className: "px-3 py-1.5", children: /* @__PURE__ */ t("span", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Pending" }) }),
229
- o.map((n) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5 text-slate-600", children: K(n, e[n.field]) }, n.field)),
228
+ o.map((r) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5 text-slate-600", children: K(r, e[r.field]) }, r.field)),
230
229
  /* @__PURE__ */ t("td", { className: "px-2 py-1.5", children: /* @__PURE__ */ t(
231
230
  "button",
232
231
  {
233
232
  type: "button",
234
- onClick: () => x == null ? void 0 : x.removeRow(l, c, r),
233
+ onClick: () => x == null ? void 0 : x.removeRow(l, c, n),
235
234
  className: "rounded p-0.5 text-slate-400 hover:text-red-500",
236
- children: /* @__PURE__ */ t(W, { className: "h-3 w-3" })
235
+ children: /* @__PURE__ */ t(U, { className: "h-3 w-3" })
237
236
  }
238
237
  ) })
239
- ] }, r)),
240
- !d && N === "original" && w.map((e, r) => {
241
- const n = String(e.id), s = q === n && !j;
238
+ ] }, n)),
239
+ !d && N === "original" && w.map((e, n) => {
240
+ const r = String(e.id), s = q === r && !j;
242
241
  return /* @__PURE__ */ a(
243
242
  "tr",
244
243
  {
245
- className: ue(
244
+ className: me(
246
245
  "border-b border-slate-100",
247
- r % 2 === 0 ? "bg-white" : "bg-slate-50/50"
246
+ n % 2 === 0 ? "bg-white" : "bg-slate-50/50"
248
247
  ),
249
248
  children: [
250
249
  o.map((i) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5", children: s ? O(
251
250
  i,
252
- D,
253
- (M, p) => I((P) => ({ ...P, [M]: p }))
251
+ _,
252
+ (I, p) => D((M) => ({ ...M, [I]: p }))
254
253
  ) : K(i, e[i.field]) }, i.field)),
255
- /* @__PURE__ */ t("td", { className: "px-2 py-1.5", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-1 justify-end", children: s ? /* @__PURE__ */ a(U, { children: [
254
+ /* @__PURE__ */ t("td", { className: "px-2 py-1.5", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-1 justify-end", children: s ? /* @__PURE__ */ a(L, { children: [
256
255
  /* @__PURE__ */ t(
257
256
  "button",
258
257
  {
259
258
  type: "button",
260
259
  disabled: g,
261
- onClick: () => X(n),
260
+ onClick: () => X(r),
262
261
  className: "rounded px-1.5 py-0.5 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
263
262
  children: g ? "…" : "Save"
264
263
  }
@@ -272,13 +271,13 @@ function Ee({
272
271
  children: "Cancel"
273
272
  }
274
273
  )
275
- ] }) : /* @__PURE__ */ a(U, { children: [
274
+ ] }) : /* @__PURE__ */ a(L, { children: [
276
275
  /* @__PURE__ */ t(
277
276
  "button",
278
277
  {
279
278
  type: "button",
280
279
  onClick: () => {
281
- C(n), I({ ...e });
280
+ C(r), D({ ...e });
282
281
  },
283
282
  className: "rounded p-0.5 text-slate-400 hover:text-slate-700",
284
283
  children: /* @__PURE__ */ t(le, { className: "h-3.5 w-3.5" })
@@ -288,19 +287,19 @@ function Ee({
288
287
  "button",
289
288
  {
290
289
  type: "button",
291
- onClick: () => re(e.id),
290
+ onClick: () => ne(e.id),
292
291
  className: "rounded p-0.5 text-slate-400 hover:text-red-500",
293
- children: /* @__PURE__ */ t(W, { className: "h-3 w-3" })
292
+ children: /* @__PURE__ */ t(U, { className: "h-3 w-3" })
294
293
  }
295
294
  )
296
295
  ] }) }) })
297
296
  ]
298
297
  },
299
- n
298
+ r
300
299
  );
301
300
  }),
302
301
  !d && N !== "original" && (() => {
303
- const e = B.find((r) => r.addendumId === N);
302
+ const e = B.find((n) => n.addendumId === N);
304
303
  return e ? e.rows.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
305
304
  "td",
306
305
  {
@@ -308,24 +307,24 @@ function Ee({
308
307
  className: "px-3 py-4 text-center text-[11px] text-amber-500",
309
308
  children: "No proposed rows in this addendum"
310
309
  }
311
- ) }) : e.rows.map((r, n) => /* @__PURE__ */ a("tr", { className: "border-b border-amber-100 bg-amber-50/60", children: [
312
- o.map((s) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5 text-[11px] text-amber-900", children: K(s, r[s.field]) }, s.field)),
310
+ ) }) : e.rows.map((n, r) => /* @__PURE__ */ a("tr", { className: "border-b border-amber-100 bg-amber-50/60", children: [
311
+ o.map((s) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5 text-[11px] text-amber-900", children: K(s, n[s.field]) }, s.field)),
313
312
  /* @__PURE__ */ t("td", { className: "px-2 py-1.5 text-right", children: /* @__PURE__ */ t("span", { className: "text-[10px] font-medium uppercase tracking-wide text-amber-400", children: "Proposed" }) })
314
- ] }, n)) : w.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
313
+ ] }, r)) : w.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
315
314
  "td",
316
315
  {
317
316
  colSpan: o.length + 1,
318
317
  className: "px-3 py-4 text-center text-[11px] text-slate-400",
319
318
  children: S ? `No ${S.toLowerCase()} yet` : "No rows"
320
319
  }
321
- ) }) : w.map((r, n) => /* @__PURE__ */ a("tr", { className: "border-b border-slate-100", children: [
322
- o.map((s) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5 text-[11px] text-slate-700", children: K(s, r[s.field]) }, s.field)),
320
+ ) }) : w.map((n, r) => /* @__PURE__ */ a("tr", { className: "border-b border-slate-100", children: [
321
+ o.map((s) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5 text-[11px] text-slate-700", children: K(s, n[s.field]) }, s.field)),
323
322
  /* @__PURE__ */ t("td", { className: "px-2 py-1.5" })
324
- ] }, n));
323
+ ] }, r));
325
324
  })(),
326
325
  N === "original" && E && !j && /* @__PURE__ */ a("tr", { className: "border-b border-slate-100 bg-nvr-cyan/5", children: [
327
326
  d && /* @__PURE__ */ t("td", { className: "px-3 py-1.5" }),
328
- ne(R, (e, r) => y((n) => ({ ...n, [e]: r }))),
327
+ re(R, (e, n) => y((r) => ({ ...r, [e]: n }))),
329
328
  /* @__PURE__ */ t("td", { className: "px-2 py-1.5", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-1 justify-end", children: [
330
329
  /* @__PURE__ */ t(
331
330
  "button",
@@ -360,16 +359,16 @@ function Ee({
360
359
  ) })
361
360
  ] })
362
361
  ] }),
363
- q && j && (w.find((r) => String(r.id) === q) ? /* @__PURE__ */ t("div", { className: "border-t border-slate-200 p-3", children: H(
364
- D,
365
- (r, n) => I((s) => ({ ...s, [r]: n })),
362
+ q && j && (w.find((n) => String(n.id) === q) ? /* @__PURE__ */ t("div", { className: "border-t border-slate-200 p-3", children: F(
363
+ _,
364
+ (n, r) => D((s) => ({ ...s, [n]: r })),
366
365
  () => X(q),
367
366
  () => C(null),
368
367
  "Edit Row"
369
368
  ) }) : null),
370
- E && j && /* @__PURE__ */ t("div", { className: "border-t border-slate-200 p-3", children: H(
369
+ E && j && /* @__PURE__ */ t("div", { className: "border-t border-slate-200 p-3", children: F(
371
370
  R,
372
- (e, r) => y((n) => ({ ...n, [e]: r })),
371
+ (e, n) => y((r) => ({ ...r, [e]: n })),
373
372
  z,
374
373
  () => {
375
374
  v(!1), y({});
@@ -387,7 +386,7 @@ function Ee({
387
386
  ) })
388
387
  ] })
389
388
  );
390
- }
389
+ });
391
390
  export {
392
- Ee as InlineGridField
391
+ $e as InlineGridField
393
392
  };
@@ -6,11 +6,11 @@ import { useNivaroClient as et } from "../../context.js";
6
6
  import { get as M } from "../../lib/commands.js";
7
7
  import { cn as T, titleCase as Ce } from "../../lib/utils.js";
8
8
  import { Skeleton as oe } from "../ui/skeleton.js";
9
- import "../../lib/field-interfaces.js";
10
- import { resolveOptionFilterTokens as je } from "../../lib/option-filter-tokens.js";
11
- import { getCascadeFilters as Ae, buildCascadeFilter as tt, parseJson as de, applyDisplayTemplate as Te } from "./helpers.js";
9
+ import "./FieldRenderer.js";
10
+ import { getCascadeFilters as je, buildCascadeFilter as tt, parseJson as de, applyDisplayTemplate as Ae } from "./helpers.js";
12
11
  import { resolveM2MRelatedCollection as nt } from "./M2MCombobox.js";
13
12
  import { collidingIds as rt, disambiguators as lt } from "./option-disambiguate.js";
13
+ import { resolveOptionFilterTokens as Te } from "../../lib/option-filter-tokens.js";
14
14
  const st = 12, at = 200, $e = (p) => {
15
15
  if (!p) return;
16
16
  const S = [...p.matchAll(/\{\{\s*([^}\s]+)\s*\}\}/g)].map((k) => k[1]);
@@ -80,7 +80,7 @@ function Nt({
80
80
  }, [F, f]);
81
81
  const le = _(() => {
82
82
  if (!(t != null && t.fc)) return;
83
- const e = Ae(t.fc.dependency_config), n = tt({
83
+ const e = je(t.fc.dependency_config), n = tt({
84
84
  rules: e,
85
85
  parentValue: (w) => {
86
86
  const E = a.find((D) => D.field === w);
@@ -95,13 +95,13 @@ function Nt({
95
95
  },
96
96
  parentOptionFilter: (w) => {
97
97
  const E = N == null ? void 0 : N[w];
98
- return E ? je(E, x, S) : void 0;
98
+ return E ? Te(E, x, S) : void 0;
99
99
  }
100
- }), r = de(t.fc.options ?? null), l = r != null && r.option_filter ? je(r.option_filter, x, S) : void 0, d = [n.filter, l].filter(
100
+ }), r = de(t.fc.options ?? null), l = r != null && r.option_filter ? Te(r.option_filter, x, S) : void 0, d = [n.filter, l].filter(
101
101
  (w) => !!w && Object.keys(w).length > 0
102
102
  ), A = d.length === 0 ? void 0 : d.length === 1 ? d[0] : { _and: d };
103
103
  return A ? JSON.stringify(A) : void 0;
104
- }, [t == null ? void 0 : t.field, t == null ? void 0 : t.fc, x, a, N, S, b]), se = _(() => t != null && t.fc ? Ae(t.fc.dependency_config).filter((n) => n.show_all_if_no_parent === !1).map((n) => n.parent_field).filter((n) => {
104
+ }, [t == null ? void 0 : t.field, t == null ? void 0 : t.fc, x, a, N, S, b]), se = _(() => t != null && t.fc ? je(t.fc.dependency_config).filter((n) => n.show_all_if_no_parent === !1).map((n) => n.parent_field).filter((n) => {
105
105
  const r = a.find((l) => l.field === n);
106
106
  return r ? !h(r) : G(x[n] ?? b(n));
107
107
  }) : [], [t == null ? void 0 : t.field, t == null ? void 0 : t.fc, x, a, b]), ue = _(
@@ -154,7 +154,7 @@ function Nt({
154
154
  ).then((e) => e.data ?? []),
155
155
  enabled: De,
156
156
  staleTime: 3e4
157
- }), I = (e) => Te(J, e) || `#${String(e.id)}`, B = _(() => {
157
+ }), I = (e) => Ae(J, e) || `#${String(e.id)}`, B = _(() => {
158
158
  const e = [...c ?? []];
159
159
  if (V) return e;
160
160
  const n = R === "-label" ? -1 : 1;
@@ -235,7 +235,7 @@ function Nt({
235
235
  const { d: n, v: r } = ge[e];
236
236
  if (G(r)) return null;
237
237
  const l = (d = He[e]) == null ? void 0 : d.data;
238
- return l != null && l.length ? l.map((A) => Te(ae(n.target), A) || `#${String(A.id)}`).join(", ") : Array.isArray(r) ? `${r.length} selected` : "…";
238
+ return l != null && l.length ? l.map((A) => Ae(ae(n.target), A) || `#${String(A.id)}`).join(", ") : Array.isArray(r) ? `${r.length} selected` : "…";
239
239
  };
240
240
  if (a.length === 0) return null;
241
241
  const ke = a.map((e, n) => h(e) ? ye(n) : null).filter((e) => !!e), Y = t ? ne(t) : null, Ne = Array.isArray(Y) ? Y.map(String) : G(Y) ? [] : [String(Y)], Z = y === a.length - 1, Ue = t ? h(t) || !t.required && !0 : !1, Xe = () => {