@object-ui/plugin-aggrid 3.1.4 → 3.3.0

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.
Files changed (52) hide show
  1. package/.turbo/turbo-build.log +57 -54
  2. package/CHANGELOG.md +33 -0
  3. package/dist/{AgGridImpl-BD5cjyc0.js → AgGridImpl-DBqxIsko.js} +1 -1
  4. package/dist/{AvatarField-IZTLB0Ye.js → AvatarField-C5b9biGa.js} +2 -2
  5. package/dist/{FileField-DxxdESfc.js → FileField-BcGMvBnI.js} +4 -4
  6. package/dist/{GeolocationField-BzKgcWLN.js → GeolocationField-D3BrmwqV.js} +1 -1
  7. package/dist/{ImageField-DK7sUV6b.js → ImageField-BBqwJEkk.js} +2 -2
  8. package/dist/{LookupField-Dmzju5Q0.js → LookupField-DoOmbbZF.js} +243 -242
  9. package/dist/LookupField-KfYQlgUd.js +2 -0
  10. package/dist/{MasterDetailField-CPLHbe_Y.js → MasterDetailField-BnSPGAtS.js} +3 -3
  11. package/dist/{ObjectAgGridImpl-4uephlvO.js → ObjectAgGridImpl-DrI0aa8t.js} +174 -174
  12. package/dist/{PasswordField-d6E-vKBI.js → PasswordField-k5JeKk9f.js} +1 -1
  13. package/dist/{QRCodeField-BIQhc73N.js → QRCodeField-BIrSW1Zr.js} +1 -1
  14. package/dist/{RatingField-BKAGmlzh.js → RatingField-5iMhn2GL.js} +1 -1
  15. package/dist/SelectField-Bjk_S2zT.js +31 -0
  16. package/dist/SelectField-CcWvzp9g.js +2 -0
  17. package/dist/{SignatureField-fFEb0h_C.js → SignatureField-BAMvNrE6.js} +1 -1
  18. package/dist/{UserField-Dqk38Arc.js → UserField-BHl6mmIH.js} +1 -1
  19. package/dist/createLucideIcon-BjfZYZey.js +42 -0
  20. package/dist/{image-Cm7ExMY2.js → image-DlUdeTgT.js} +1 -1
  21. package/dist/index.css +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/index.umd.cjs +69 -69
  25. package/dist/{plus-CsEgF66K.js → plus-BwEV_Q5_.js} +1 -1
  26. package/dist/{upload-B1x-ueFd.js → upload-DPiohvXv.js} +1 -1
  27. package/dist/useFieldTranslation-C69OtouR.js +305 -0
  28. package/dist/{x-Bwhzfvtg.js → x-BFq2GeQ5.js} +1 -1
  29. package/package.json +11 -11
  30. package/src/ag-grid.d.ts +10 -0
  31. package/vite.config.ts +1 -0
  32. package/dist/SelectField-C2gtlnLZ.js +0 -30
  33. package/dist/createLucideIcon-CWx7zIL1.js +0 -39
  34. /package/dist/{NumberField-JaSlPVXs.js → NumberField-Kz4_o5DE.js} +0 -0
  35. /package/dist/{ObjectField-FzUYlu-m.js → ObjectField-C1qkl6s4.js} +0 -0
  36. /package/dist/{PercentField-D2_kMuC_.js → PercentField-Dmipqv0I.js} +0 -0
  37. /package/dist/{PhoneField-DOaMivd6.js → PhoneField-Dn4h6V9H.js} +0 -0
  38. /package/dist/{RichTextField-D4FIV9V8.js → RichTextField-CN5BRd_7.js} +0 -0
  39. /package/dist/{SliderField-BlAlK3g2.js → SliderField-C9IhmjbF.js} +0 -0
  40. /package/dist/{SummaryField-Dy2Kkj6M.js → SummaryField-R9RENAZv.js} +0 -0
  41. /package/dist/{TextAreaField-BCUkjKTc.js → TextAreaField-BY63Nr6-.js} +0 -0
  42. /package/dist/{TextField-XWOnbUrk.js → TextField-SIw8aMzf.js} +0 -0
  43. /package/dist/{TimeField-CZdzdqOO.js → TimeField-xxziHPjE.js} +0 -0
  44. /package/dist/{UrlField-sq1mpRoG.js → UrlField-Ihk3_ff5.js} +0 -0
  45. /package/dist/{VectorField-CY70VLiW.js → VectorField-Ci167cxr.js} +0 -0
  46. /package/dist/{src → packages/plugin-aggrid/src}/AgGridImpl.d.ts +0 -0
  47. /package/dist/{src → packages/plugin-aggrid/src}/ObjectAgGridImpl.d.ts +0 -0
  48. /package/dist/{src → packages/plugin-aggrid/src}/VirtualScrolling.d.ts +0 -0
  49. /package/dist/{src → packages/plugin-aggrid/src}/field-renderers.d.ts +0 -0
  50. /package/dist/{src → packages/plugin-aggrid/src}/index.d.ts +0 -0
  51. /package/dist/{src → packages/plugin-aggrid/src}/object-aggrid.types.d.ts +0 -0
  52. /package/dist/{src → packages/plugin-aggrid/src}/types.d.ts +0 -0
@@ -1,17 +1,18 @@
1
- import { r as e, t } from "./jsx-runtime-CGDkM_Jn.js";
2
- import { t as n } from "./createLucideIcon-CWx7zIL1.js";
3
- import { t as r } from "./plus-CsEgF66K.js";
4
- import { t as i } from "./x-Bwhzfvtg.js";
1
+ import { t as e } from "./jsx-runtime-CGDkM_Jn.js";
2
+ import { t } from "./createLucideIcon-BjfZYZey.js";
3
+ import { t as n } from "./plus-BwEV_Q5_.js";
4
+ import { t as r } from "./x-BFq2GeQ5.js";
5
+ import { t as i } from "./useFieldTranslation-C69OtouR.js";
5
6
  import { useCallback as a, useContext as ee, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
6
- import { Badge as u, Button as d, Checkbox as te, Dialog as ne, DialogContent as re, DialogFooter as f, DialogHeader as p, DialogTitle as ie, Input as m, Label as h, Popover as ae, PopoverContent as oe, PopoverTrigger as se, Select as ce, SelectContent as le, SelectItem as ue, SelectTrigger as de, SelectValue as fe, Skeleton as g, Table as pe, TableBody as _, TableCell as v, TableHead as me, TableHeader as y, TableRow as b, cn as he } from "@object-ui/components";
7
+ import { Badge as u, Button as d, Checkbox as te, Dialog as ne, DialogContent as re, DialogFooter as f, DialogHeader as p, DialogTitle as m, Input as h, Label as g, Popover as ie, PopoverContent as ae, PopoverTrigger as oe, Select as se, SelectContent as ce, SelectItem as le, SelectTrigger as ue, SelectValue as de, Skeleton as _, Table as fe, TableBody as v, TableCell as pe, TableHead as y, TableHeader as me, TableRow as he, cn as b } from "@object-ui/components";
7
8
  import { SchemaRendererContext as x } from "@object-ui/react";
8
- var S = n("arrow-down", [["path", {
9
+ var ge = t("arrow-down", [["path", {
9
10
  d: "M12 5v14",
10
11
  key: "s699le"
11
12
  }], ["path", {
12
13
  d: "m19 12-7 7-7-7",
13
14
  key: "1idqje"
14
- }]]), C = n("arrow-up-down", [
15
+ }]]), S = t("arrow-up-down", [
15
16
  ["path", {
16
17
  d: "m21 16-4 4-4-4",
17
18
  key: "f6ql7i"
@@ -28,22 +29,22 @@ var S = n("arrow-down", [["path", {
28
29
  d: "M7 4v16",
29
30
  key: "1glfcx"
30
31
  }]
31
- ]), ge = n("arrow-up", [["path", {
32
+ ]), C = t("arrow-up", [["path", {
32
33
  d: "m5 12 7-7 7 7",
33
34
  key: "hav0vg"
34
35
  }], ["path", {
35
36
  d: "M12 19V5",
36
37
  key: "x0mq9r"
37
- }]]), w = n("check", [["path", {
38
+ }]]), w = t("check", [["path", {
38
39
  d: "M20 6 9 17l-5-5",
39
40
  key: "1gmf2c"
40
- }]]), T = n("chevron-left", [["path", {
41
+ }]]), _e = t("chevron-left", [["path", {
41
42
  d: "m15 18-6-6 6-6",
42
43
  key: "1wnfg3"
43
- }]]), _e = n("chevron-right", [["path", {
44
+ }]]), T = t("chevron-right", [["path", {
44
45
  d: "m9 18 6-6-6-6",
45
46
  key: "mthhwq"
46
- }]]), ve = n("circle-alert", [
47
+ }]]), ve = t("circle-alert", [
47
48
  ["circle", {
48
49
  cx: "12",
49
50
  cy: "12",
@@ -64,10 +65,10 @@ var S = n("arrow-down", [["path", {
64
65
  y2: "16",
65
66
  key: "4dfq90"
66
67
  }]
67
- ]), ye = n("loader-circle", [["path", {
68
+ ]), ye = t("loader-circle", [["path", {
68
69
  d: "M21 12a9 9 0 1 1-6.219-8.56",
69
70
  key: "13zald"
70
- }]]), be = n("search", [["path", {
71
+ }]]), be = t("search", [["path", {
71
72
  d: "m21 21-4.34-4.34",
72
73
  key: "14j7rj"
73
74
  }], ["circle", {
@@ -75,7 +76,7 @@ var S = n("arrow-down", [["path", {
75
76
  cy: "11",
76
77
  r: "8",
77
78
  key: "4ej97u"
78
- }]]), E = n("sliders-horizontal", [
79
+ }]]), E = t("sliders-horizontal", [
79
80
  ["path", {
80
81
  d: "M10 5H3",
81
82
  key: "1qgfaw"
@@ -112,7 +113,7 @@ var S = n("arrow-down", [["path", {
112
113
  d: "M8 12H3",
113
114
  key: "a7s4jb"
114
115
  }]
115
- ]), D = n("table-properties", [
116
+ ]), D = t("table-properties", [
116
117
  ["path", {
117
118
  d: "M15 3v18",
118
119
  key: "14nvp0"
@@ -133,14 +134,14 @@ var S = n("arrow-down", [["path", {
133
134
  d: "M21 15H3",
134
135
  key: "9uk58r"
135
136
  }]
136
- ]), O = t(), k = 10, xe = 60, Se = 5;
137
- function Ce(e) {
137
+ ]), O = e(), xe = 10, k = 60, A = 5;
138
+ function j(e) {
138
139
  return typeof e == "string" ? { field: e } : e;
139
140
  }
140
- function A(e) {
141
+ function M(e) {
141
142
  return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
142
143
  }
143
- function we(e) {
144
+ function Se(e) {
144
145
  let t = {};
145
146
  for (let n of e) switch (n.operator) {
146
147
  case "eq":
@@ -173,7 +174,7 @@ function we(e) {
173
174
  }
174
175
  return t;
175
176
  }
176
- function j(e, t) {
177
+ function Ce(e, t) {
177
178
  let n = {};
178
179
  for (let r of t) {
179
180
  let t = e[r.field];
@@ -181,17 +182,17 @@ function j(e, t) {
181
182
  }
182
183
  return n;
183
184
  }
184
- function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r = !1, dataSource: ee, objectName: u, columns: ae, displayField: oe = "name", idField: se = "id", pageSize: x = k, value: D, onSelect: M, onSelectRecords: N, lookupFilters: P, cellRenderer: Te, filterColumns: F, renderFilterBar: Ee, renderGrid: De }) {
185
- let [I, Oe] = l([]), [L, R] = l(!1), [z, B] = l(null), [V, ke] = l(0), [H, Ae] = l(""), [U, W] = l(1), G = c(null), [K, je] = l(null), [q, Me] = l("asc"), [Ne, Pe] = l(/* @__PURE__ */ new Set()), Fe = c(/* @__PURE__ */ new Map()), [J, Ie] = l(-1), Le = c(null), [Re, ze] = l(!1), [Y, Be] = l({}), [Ve, He] = l({}), X = c(null), [Ue, We] = l(""), Ge = s(() => ae && ae.length > 0 ? ae.map(Ce) : [{
186
- field: oe,
187
- label: A(oe)
188
- }], [ae, oe]), Z = s(() => {
189
- if (F && F.length > 0) return F;
190
- if (P && P.length > 0) return P.map((e) => {
185
+ function N({ open: e, onOpenChange: t, title: n = "Select Record", multiple: i = !1, dataSource: ee, objectName: u, columns: ie, displayField: ae = "name", idField: oe = "id", pageSize: x = xe, value: D, onSelect: N, onSelectRecords: P, lookupFilters: F, cellRenderer: I, filterColumns: we, renderFilterBar: Te, renderGrid: Ee }) {
186
+ let [L, R] = l([]), [z, De] = l(!1), [B, V] = l(null), [H, Oe] = l(0), [ke, Ae] = l(""), [U, W] = l(1), G = c(null), [K, je] = l(null), [q, Me] = l("asc"), [Ne, Pe] = l(/* @__PURE__ */ new Set()), Fe = c(/* @__PURE__ */ new Map()), [J, Ie] = l(-1), Le = c(null), [Re, ze] = l(!1), [Y, Be] = l({}), [Ve, He] = l({}), X = c(null), [Ue, We] = l(""), Ge = s(() => ie && ie.length > 0 ? ie.map(j) : [{
187
+ field: ae,
188
+ label: M(ae)
189
+ }], [ie, ae]), Z = s(() => {
190
+ if (we && we.length > 0) return we;
191
+ if (F && F.length > 0) return F.map((e) => {
191
192
  let t = "text";
192
193
  return typeof e.value == "boolean" ? t = "boolean" : Array.isArray(e.value) ? t = "select" : typeof e.value == "number" || e.operator === "gt" || e.operator === "lt" || e.operator === "gte" || e.operator === "lte" ? t = "number" : (e.operator === "in" || e.operator === "notIn") && (t = "select"), {
193
194
  field: e.field,
194
- label: A(e.field),
195
+ label: M(e.field),
195
196
  type: t,
196
197
  ...Array.isArray(e.value) ? { options: e.value.map((e) => {
197
198
  if (typeof e == "object" && e) {
@@ -208,19 +209,19 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
208
209
  }) } : {}
209
210
  };
210
211
  });
211
- }, [F, P]), Ke = s(() => {
212
- let e = P?.length ? we(P) : {}, t = Z?.length ? j(Y, Z) : {}, n = {
212
+ }, [we, F]), Ke = s(() => {
213
+ let e = F?.length ? Se(F) : {}, t = Z?.length ? Ce(Y, Z) : {}, n = {
213
214
  ...e,
214
215
  ...t
215
216
  };
216
217
  return Object.keys(n).length > 0 ? n : void 0;
217
218
  }, [
218
- P,
219
+ F,
219
220
  Z,
220
221
  Y
221
- ]), Q = Math.max(1, Math.ceil(V / x)), qe = a(async (e, t = 1, n, r) => {
222
+ ]), Q = Math.max(1, Math.ceil(H / x)), qe = a(async (e, t = 1, n, r) => {
222
223
  if (!(!ee || !u)) {
223
- R(!0), B(null);
224
+ De(!0), V(null);
224
225
  try {
225
226
  let i = {
226
227
  $top: x,
@@ -230,11 +231,11 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
230
231
  let a = r === void 0 ? Ke : r;
231
232
  a && Object.keys(a).length > 0 && (i.$filter = a);
232
233
  let o = await ee.find(u, i), s = o?.data ?? o ?? [];
233
- Oe(s), ke(o?.total ?? s.length), Ie(-1);
234
+ R(s), Oe(o?.total ?? s.length), Ie(-1);
234
235
  } catch (e) {
235
- B(e instanceof Error ? e.message : String(e)), Oe([]);
236
+ V(e instanceof Error ? e.message : String(e)), R([]);
236
237
  } finally {
237
- R(!1);
238
+ De(!1);
238
239
  }
239
240
  }
240
241
  }, [
@@ -247,19 +248,19 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
247
248
  direction: q
248
249
  } : null, [K, q]);
249
250
  o(() => {
250
- e || (Ae(""), W(1), B(null), Oe([]), je(null), Me("asc"), Ie(-1), ze(!1), Be({}), He({}), We(""), Pe(new Set(r && Array.isArray(D) ? D : [])), Fe.current.clear());
251
+ e || (Ae(""), W(1), V(null), R([]), je(null), Me("asc"), Ie(-1), ze(!1), Be({}), He({}), We(""), Pe(new Set(i && Array.isArray(D) ? D : [])), Fe.current.clear());
251
252
  }, [e]), o(() => {
252
- e && qe(H || void 0, U, Je);
253
+ e && qe(ke || void 0, U, Je);
253
254
  }, [
254
255
  e,
255
256
  U,
256
257
  Je,
257
258
  Ke
258
259
  ]), o(() => {
259
- e && r && Pe(new Set(Array.isArray(D) ? D : []));
260
+ e && i && Pe(new Set(Array.isArray(D) ? D : []));
260
261
  }, [
261
262
  e,
262
- r,
263
+ i,
263
264
  D
264
265
  ]);
265
266
  let Ye = a((e) => {
@@ -272,35 +273,35 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
272
273
  }, []);
273
274
  let Xe = a((e) => {
274
275
  je((t) => t === e ? (Me((e) => e === "asc" ? "desc" : "asc"), e) : (Me("asc"), e)), W(1);
275
- }, []), Ze = a((e) => e[se] ?? e.id ?? e._id, [se]), Qe = a((e) => {
276
+ }, []), Ze = a((e) => e[oe] ?? e.id ?? e._id, [oe]), Qe = a((e) => {
276
277
  let t = Ze(e);
277
- return r ? Ne.has(t) : D === t;
278
+ return i ? Ne.has(t) : D === t;
278
279
  }, [
279
- r,
280
+ i,
280
281
  D,
281
282
  Ne,
282
283
  Ze
283
284
  ]), $e = a((e) => {
284
285
  let n = Ze(e);
285
- r ? Pe((t) => {
286
+ i ? Pe((t) => {
286
287
  let r = new Set(t);
287
288
  return r.has(n) ? (r.delete(n), Fe.current.delete(n)) : (r.add(n), Fe.current.set(n, e)), r;
288
- }) : (M(n), N?.([e]), t(!1));
289
+ }) : (N(n), P?.([e]), t(!1));
289
290
  }, [
290
- r,
291
+ i,
291
292
  Ze,
292
- M,
293
293
  N,
294
+ P,
294
295
  t
295
296
  ]), et = a(() => {
296
297
  let e = Array.from(Ne);
297
- M(e);
298
+ N(e);
298
299
  let n = e.map((e) => Fe.current.get(e)).filter(Boolean);
299
- N?.(n), t(!1);
300
+ P?.(n), t(!1);
300
301
  }, [
301
302
  Ne,
302
- M,
303
303
  N,
304
+ P,
304
305
  t
305
306
  ]), tt = a(() => {
306
307
  W((e) => Math.max(1, e - 1));
@@ -311,9 +312,9 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
311
312
  let t = parseInt(Ue, 10);
312
313
  !isNaN(t) && t >= 1 && t <= Q && W(t), We("");
313
314
  }, [Ue, Q]), it = a((e) => {
314
- I.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), Ie((e) => Math.min(e + 1, I.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), Ie((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), J >= 0 && J < I.length && $e(I[J])));
315
+ L.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), Ie((e) => Math.min(e + 1, L.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), Ie((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), J >= 0 && J < L.length && $e(L[J])));
315
316
  }, [
316
- I,
317
+ L,
317
318
  J,
318
319
  $e
319
320
  ]);
@@ -325,8 +326,8 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
325
326
  }, [J]);
326
327
  let at = a((e, t) => {
327
328
  let n = e[t.field];
328
- if (t.type && Te) {
329
- let e = Te(t.type);
329
+ if (t.type && I) {
330
+ let e = I(t.type);
330
331
  if (e) return /* @__PURE__ */ (0, O.jsx)(e, {
331
332
  value: n,
332
333
  field: {
@@ -336,7 +337,7 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
336
337
  });
337
338
  }
338
339
  return n == null ? "" : typeof n == "object" ? n.$numberDecimal ? String(Number(n.$numberDecimal)) : n.$oid ? String(n.$oid) : n.$date ? new Date(n.$date).toLocaleDateString() : n.name || n.label ? String(n.name || n.label) : JSON.stringify(n) : typeof n == "boolean" ? n ? "Yes" : "No" : String(n);
339
- }, [Te]), ot = a((e) => K === e ? q === "asc" ? /* @__PURE__ */ (0, O.jsx)(ge, { className: "ml-1 size-3" }) : /* @__PURE__ */ (0, O.jsx)(S, { className: "ml-1 size-3" }) : /* @__PURE__ */ (0, O.jsx)(C, { className: "ml-1 size-3 opacity-40" }), [K, q]), st = a((e, t, n) => {
340
+ }, [I]), ot = a((e) => K === e ? q === "asc" ? /* @__PURE__ */ (0, O.jsx)(C, { className: "ml-1 size-3" }) : /* @__PURE__ */ (0, O.jsx)(ge, { className: "ml-1 size-3" }) : /* @__PURE__ */ (0, O.jsx)(S, { className: "ml-1 size-3 opacity-40" }), [K, q]), st = a((e, t, n) => {
340
341
  e.preventDefault(), e.stopPropagation(), X.current = {
341
342
  field: t,
342
343
  startX: e.clientX,
@@ -344,7 +345,7 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
344
345
  };
345
346
  let r = (e) => {
346
347
  if (!X.current) return;
347
- let t = e.clientX - X.current.startX, n = Math.max(xe, X.current.startWidth + t);
348
+ let t = e.clientX - X.current.startX, n = Math.max(k, X.current.startWidth + t);
348
349
  He((e) => ({
349
350
  ...e,
350
351
  [X.current.field]: n
@@ -361,20 +362,20 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
361
362
  }, []), ct = a(() => {
362
363
  Be({}), W(1);
363
364
  }, []), lt = s(() => Object.values(Y).filter((e) => e != null && e !== "").length, [Y]), ut = a((e) => {
364
- let t = Y[e.field], n = e.label || A(e.field);
365
+ let t = Y[e.field], n = e.label || M(e.field);
365
366
  switch (e.type) {
366
367
  case "select": return /* @__PURE__ */ (0, O.jsxs)("div", {
367
368
  className: "space-y-1",
368
- children: [/* @__PURE__ */ (0, O.jsx)(h, {
369
+ children: [/* @__PURE__ */ (0, O.jsx)(g, {
369
370
  className: "text-xs text-muted-foreground",
370
371
  children: n
371
- }), /* @__PURE__ */ (0, O.jsxs)(ce, {
372
+ }), /* @__PURE__ */ (0, O.jsxs)(se, {
372
373
  value: t == null ? "" : String(t),
373
374
  onValueChange: (t) => $(e.field, t),
374
- children: [/* @__PURE__ */ (0, O.jsx)(de, {
375
+ children: [/* @__PURE__ */ (0, O.jsx)(ue, {
375
376
  className: "h-8 text-xs",
376
- children: /* @__PURE__ */ (0, O.jsx)(fe, { placeholder: `Filter ${n}` })
377
- }), /* @__PURE__ */ (0, O.jsx)(le, { children: e.options?.map((e) => /* @__PURE__ */ (0, O.jsx)(ue, {
377
+ children: /* @__PURE__ */ (0, O.jsx)(de, { placeholder: `Filter ${n}` })
378
+ }), /* @__PURE__ */ (0, O.jsx)(ce, { children: e.options?.map((e) => /* @__PURE__ */ (0, O.jsx)(le, {
378
379
  value: String(e.value),
379
380
  children: e.label
380
381
  }, String(e.value))) })]
@@ -382,10 +383,10 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
382
383
  });
383
384
  case "number": return /* @__PURE__ */ (0, O.jsxs)("div", {
384
385
  className: "space-y-1",
385
- children: [/* @__PURE__ */ (0, O.jsx)(h, {
386
+ children: [/* @__PURE__ */ (0, O.jsx)(g, {
386
387
  className: "text-xs text-muted-foreground",
387
388
  children: n
388
- }), /* @__PURE__ */ (0, O.jsx)(m, {
389
+ }), /* @__PURE__ */ (0, O.jsx)(h, {
389
390
  type: "number",
390
391
  className: "h-8 text-xs",
391
392
  value: t ?? "",
@@ -398,10 +399,10 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
398
399
  });
399
400
  case "date": return /* @__PURE__ */ (0, O.jsxs)("div", {
400
401
  className: "space-y-1",
401
- children: [/* @__PURE__ */ (0, O.jsx)(h, {
402
+ children: [/* @__PURE__ */ (0, O.jsx)(g, {
402
403
  className: "text-xs text-muted-foreground",
403
404
  children: n
404
- }), /* @__PURE__ */ (0, O.jsx)(m, {
405
+ }), /* @__PURE__ */ (0, O.jsx)(h, {
405
406
  type: "date",
406
407
  className: "h-8 text-xs",
407
408
  value: t ?? "",
@@ -410,7 +411,7 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
410
411
  });
411
412
  case "boolean": return /* @__PURE__ */ (0, O.jsxs)("div", {
412
413
  className: "space-y-1",
413
- children: [/* @__PURE__ */ (0, O.jsx)(h, {
414
+ children: [/* @__PURE__ */ (0, O.jsx)(g, {
414
415
  className: "text-xs text-muted-foreground",
415
416
  children: n
416
417
  }), /* @__PURE__ */ (0, O.jsxs)("div", {
@@ -426,10 +427,10 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
426
427
  });
427
428
  default: return /* @__PURE__ */ (0, O.jsxs)("div", {
428
429
  className: "space-y-1",
429
- children: [/* @__PURE__ */ (0, O.jsx)(h, {
430
+ children: [/* @__PURE__ */ (0, O.jsx)(g, {
430
431
  className: "text-xs text-muted-foreground",
431
432
  children: n
432
- }), /* @__PURE__ */ (0, O.jsx)(m, {
433
+ }), /* @__PURE__ */ (0, O.jsx)(h, {
433
434
  className: "h-8 text-xs",
434
435
  value: t ?? "",
435
436
  placeholder: `Filter ${n}`,
@@ -445,7 +446,7 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
445
446
  className: "w-[95vw] sm:max-w-3xl lg:max-w-5xl max-h-[85vh] sm:max-h-[80vh] flex flex-col gap-0",
446
447
  "data-testid": "record-picker-dialog",
447
448
  children: [
448
- /* @__PURE__ */ (0, O.jsx)(p, { children: /* @__PURE__ */ (0, O.jsxs)(ie, { children: [n, r && /* @__PURE__ */ (0, O.jsx)("span", {
449
+ /* @__PURE__ */ (0, O.jsx)(p, { children: /* @__PURE__ */ (0, O.jsxs)(m, { children: [n, i && /* @__PURE__ */ (0, O.jsx)("span", {
449
450
  className: "sr-only",
450
451
  children: " (multiple selection)"
451
452
  })] }) }),
@@ -453,14 +454,14 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
453
454
  className: "relative rounded-md border bg-muted/30 mb-3",
454
455
  children: [
455
456
  /* @__PURE__ */ (0, O.jsx)(be, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
456
- /* @__PURE__ */ (0, O.jsx)(m, {
457
+ /* @__PURE__ */ (0, O.jsx)(h, {
457
458
  placeholder: "Search...",
458
- value: H,
459
+ value: ke,
459
460
  onChange: (e) => Ye(e.target.value),
460
461
  className: "pl-9 border-0 bg-transparent shadow-none focus-visible:ring-0",
461
462
  "data-testid": "record-picker-search"
462
463
  }),
463
- L && /* @__PURE__ */ (0, O.jsx)(ye, {
464
+ z && /* @__PURE__ */ (0, O.jsx)(ye, {
464
465
  className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
465
466
  "data-testid": "record-picker-loading-indicator"
466
467
  })
@@ -468,9 +469,9 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
468
469
  }),
469
470
  Z && Z.length > 0 && /* @__PURE__ */ (0, O.jsx)("div", {
470
471
  className: "py-2",
471
- children: Ee ? /* @__PURE__ */ (0, O.jsx)("div", {
472
+ children: Te ? /* @__PURE__ */ (0, O.jsx)("div", {
472
473
  "data-testid": "record-picker-filter-bar",
473
- children: Ee({
474
+ children: Te({
474
475
  filterColumns: Z,
475
476
  values: Y,
476
477
  onChange: $,
@@ -500,7 +501,7 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
500
501
  size: "sm",
501
502
  className: "gap-1 text-xs",
502
503
  onClick: ct,
503
- children: [/* @__PURE__ */ (0, O.jsx)(i, { className: "size-3" }), "Clear"]
504
+ children: [/* @__PURE__ */ (0, O.jsx)(r, { className: "size-3" }), "Clear"]
504
505
  })]
505
506
  }), Re && /* @__PURE__ */ (0, O.jsx)("div", {
506
507
  className: "mt-2 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 border rounded-md p-3 bg-muted/30",
@@ -508,32 +509,32 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
508
509
  children: Z.map((e) => /* @__PURE__ */ (0, O.jsx)("div", { children: ut(e) }, e.field))
509
510
  })] })
510
511
  }),
511
- z && /* @__PURE__ */ (0, O.jsxs)("div", {
512
+ B && /* @__PURE__ */ (0, O.jsxs)("div", {
512
513
  className: "flex flex-col items-center gap-2 py-4",
513
514
  role: "alert",
514
515
  children: [
515
516
  /* @__PURE__ */ (0, O.jsx)(ve, { className: "size-5 text-destructive" }),
516
517
  /* @__PURE__ */ (0, O.jsx)("p", {
517
518
  className: "text-sm text-destructive",
518
- children: z
519
+ children: B
519
520
  }),
520
521
  /* @__PURE__ */ (0, O.jsx)(d, {
521
522
  variant: "outline",
522
523
  size: "sm",
523
- onClick: () => qe(H || void 0, U, Je),
524
+ onClick: () => qe(ke || void 0, U, Je),
524
525
  type: "button",
525
526
  children: "Retry"
526
527
  })
527
528
  ]
528
529
  }),
529
- De ? /* @__PURE__ */ (0, O.jsx)("div", {
530
+ Ee ? /* @__PURE__ */ (0, O.jsx)("div", {
530
531
  className: "flex-1 min-h-0",
531
532
  "data-testid": "record-picker-grid-slot",
532
- children: De({
533
+ children: Ee({
533
534
  columns: Ge,
534
- records: I,
535
- loading: L,
536
- totalCount: V,
535
+ records: L,
536
+ loading: z,
537
+ totalCount: H,
537
538
  currentPage: U,
538
539
  pageSize: x,
539
540
  sortField: K,
@@ -542,49 +543,49 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
542
543
  onPageChange: W,
543
544
  onRowClick: $e,
544
545
  isSelected: Qe,
545
- multiple: r,
546
- idField: se,
547
- cellRenderer: Te
546
+ multiple: i,
547
+ idField: oe,
548
+ cellRenderer: I
548
549
  })
549
550
  }) : /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [
550
- L && I.length === 0 && !z && /* @__PURE__ */ (0, O.jsx)("div", {
551
+ z && L.length === 0 && !B && /* @__PURE__ */ (0, O.jsx)("div", {
551
552
  className: "flex-1 overflow-hidden min-h-0 border rounded-md",
552
553
  role: "status",
553
554
  "aria-live": "polite",
554
555
  "data-testid": "record-picker-skeleton",
555
- children: /* @__PURE__ */ (0, O.jsxs)(pe, { children: [/* @__PURE__ */ (0, O.jsx)(y, { children: /* @__PURE__ */ (0, O.jsxs)(b, {
556
+ children: /* @__PURE__ */ (0, O.jsxs)(fe, { children: [/* @__PURE__ */ (0, O.jsx)(me, { children: /* @__PURE__ */ (0, O.jsxs)(he, {
556
557
  className: "bg-muted/40",
557
- children: [r && /* @__PURE__ */ (0, O.jsx)(me, { className: "w-10" }), Ge.map((e) => /* @__PURE__ */ (0, O.jsx)(me, { children: /* @__PURE__ */ (0, O.jsx)(g, { className: "h-4 w-20" }) }, e.field))]
558
- }) }), /* @__PURE__ */ (0, O.jsx)(_, { children: Array.from({ length: Se }, (e, t) => /* @__PURE__ */ (0, O.jsxs)(b, { children: [r && /* @__PURE__ */ (0, O.jsx)(v, {
558
+ children: [i && /* @__PURE__ */ (0, O.jsx)(y, { className: "w-10" }), Ge.map((e) => /* @__PURE__ */ (0, O.jsx)(y, { children: /* @__PURE__ */ (0, O.jsx)(_, { className: "h-4 w-20" }) }, e.field))]
559
+ }) }), /* @__PURE__ */ (0, O.jsx)(v, { children: Array.from({ length: A }, (e, t) => /* @__PURE__ */ (0, O.jsxs)(he, { children: [i && /* @__PURE__ */ (0, O.jsx)(pe, {
559
560
  className: "w-10",
560
- children: /* @__PURE__ */ (0, O.jsx)(g, { className: "size-4 rounded" })
561
- }), Ge.map((e) => /* @__PURE__ */ (0, O.jsx)(v, { children: /* @__PURE__ */ (0, O.jsx)(g, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
561
+ children: /* @__PURE__ */ (0, O.jsx)(_, { className: "size-4 rounded" })
562
+ }), Ge.map((e) => /* @__PURE__ */ (0, O.jsx)(pe, { children: /* @__PURE__ */ (0, O.jsx)(_, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
562
563
  }),
563
- !L && !z && I.length === 0 && /* @__PURE__ */ (0, O.jsx)("div", {
564
+ !z && !B && L.length === 0 && /* @__PURE__ */ (0, O.jsx)("div", {
564
565
  className: "py-8 text-center",
565
566
  children: /* @__PURE__ */ (0, O.jsx)("p", {
566
567
  className: "text-sm text-muted-foreground",
567
568
  children: "No records found"
568
569
  })
569
570
  }),
570
- !z && I.length > 0 && /* @__PURE__ */ (0, O.jsxs)("div", {
571
+ !B && L.length > 0 && /* @__PURE__ */ (0, O.jsxs)("div", {
571
572
  className: "relative flex-1 overflow-auto min-h-0 border rounded-md",
572
573
  tabIndex: 0,
573
574
  onKeyDown: it,
574
575
  role: "grid",
575
576
  "aria-label": "Records",
576
- children: [L && /* @__PURE__ */ (0, O.jsx)("div", {
577
+ children: [z && /* @__PURE__ */ (0, O.jsx)("div", {
577
578
  className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60",
578
579
  "data-testid": "record-picker-loading-overlay",
579
580
  children: /* @__PURE__ */ (0, O.jsx)(ye, { className: "size-6 animate-spin text-muted-foreground" })
580
- }), /* @__PURE__ */ (0, O.jsxs)(pe, {
581
+ }), /* @__PURE__ */ (0, O.jsxs)(fe, {
581
582
  style: Object.keys(Ve).length > 0 ? { tableLayout: "fixed" } : void 0,
582
- children: [/* @__PURE__ */ (0, O.jsx)(y, {
583
+ children: [/* @__PURE__ */ (0, O.jsx)(me, {
583
584
  className: "sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b",
584
585
  "data-testid": "record-picker-sticky-header",
585
- children: /* @__PURE__ */ (0, O.jsxs)(b, { children: [r && /* @__PURE__ */ (0, O.jsx)(me, { className: "w-10" }), Ge.map((e) => {
586
+ children: /* @__PURE__ */ (0, O.jsxs)(he, { children: [i && /* @__PURE__ */ (0, O.jsx)(y, { className: "w-10" }), Ge.map((e) => {
586
587
  let t = Ve[e.field];
587
- return /* @__PURE__ */ (0, O.jsxs)(me, {
588
+ return /* @__PURE__ */ (0, O.jsxs)(y, {
588
589
  style: t ? {
589
590
  width: `${t}px`,
590
591
  minWidth: `${t}px`
@@ -594,7 +595,7 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
594
595
  "aria-sort": K === e.field ? q === "asc" ? "ascending" : "descending" : "none",
595
596
  children: [/* @__PURE__ */ (0, O.jsxs)("span", {
596
597
  className: "inline-flex items-center",
597
- children: [e.label || A(e.field), ot(e.field)]
598
+ children: [e.label || M(e.field), ot(e.field)]
598
599
  }), /* @__PURE__ */ (0, O.jsx)("span", {
599
600
  role: "separator",
600
601
  "aria-orientation": "vertical",
@@ -608,20 +609,20 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
608
609
  })]
609
610
  }, e.field);
610
611
  })] })
611
- }), /* @__PURE__ */ (0, O.jsx)(_, {
612
+ }), /* @__PURE__ */ (0, O.jsx)(v, {
612
613
  ref: Le,
613
- children: I.map((e, t) => {
614
- let n = Ze(e), i = Qe(e), a = t === J;
615
- return /* @__PURE__ */ (0, O.jsxs)(b, {
614
+ children: L.map((e, t) => {
615
+ let n = Ze(e), r = Qe(e), a = t === J;
616
+ return /* @__PURE__ */ (0, O.jsxs)(he, {
616
617
  "data-row-index": t,
617
- className: he("cursor-pointer transition-colors", dt(i, t), a && "ring-2 ring-primary ring-inset"),
618
+ className: b("cursor-pointer transition-colors", dt(r, t), a && "ring-2 ring-primary ring-inset"),
618
619
  onClick: () => $e(e),
619
620
  "data-testid": `record-row-${n}`,
620
- "aria-selected": i,
621
- children: [r && /* @__PURE__ */ (0, O.jsx)(v, {
621
+ "aria-selected": r,
622
+ children: [i && /* @__PURE__ */ (0, O.jsx)(pe, {
622
623
  className: "w-10",
623
- children: i && /* @__PURE__ */ (0, O.jsx)(w, { className: "size-4 text-primary" })
624
- }), Ge.map((t) => /* @__PURE__ */ (0, O.jsx)(v, {
624
+ children: r && /* @__PURE__ */ (0, O.jsx)(w, { className: "size-4 text-primary" })
625
+ }), Ge.map((t) => /* @__PURE__ */ (0, O.jsx)(pe, {
625
626
  className: "py-2.5",
626
627
  children: at(e, t)
627
628
  }, t.field))]
@@ -630,13 +631,13 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
630
631
  })]
631
632
  })]
632
633
  }),
633
- !z && V > 0 && /* @__PURE__ */ (0, O.jsxs)("div", {
634
+ !B && H > 0 && /* @__PURE__ */ (0, O.jsxs)("div", {
634
635
  className: "flex items-center justify-between text-sm text-muted-foreground border-t pt-3 mt-2 px-1",
635
636
  "data-testid": "record-picker-pagination",
636
637
  children: [/* @__PURE__ */ (0, O.jsxs)("span", { children: [
637
- V,
638
+ H,
638
639
  " ",
639
- V === 1 ? "record" : "records",
640
+ H === 1 ? "record" : "records",
640
641
  Q > 1 && ` · Page ${U} of ${Q}`
641
642
  ] }), Q > 1 && /* @__PURE__ */ (0, O.jsxs)("div", {
642
643
  className: "flex items-center gap-1.5",
@@ -649,9 +650,9 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
649
650
  disabled: U <= 1,
650
651
  type: "button",
651
652
  "aria-label": "Previous page",
652
- children: /* @__PURE__ */ (0, O.jsx)(T, { className: "size-4" })
653
+ children: /* @__PURE__ */ (0, O.jsx)(_e, { className: "size-4" })
653
654
  }),
654
- /* @__PURE__ */ (0, O.jsx)(m, {
655
+ /* @__PURE__ */ (0, O.jsx)(h, {
655
656
  className: "h-7 w-12 text-center text-xs px-1",
656
657
  placeholder: String(U),
657
658
  value: Ue,
@@ -668,13 +669,13 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
668
669
  disabled: U >= Q,
669
670
  type: "button",
670
671
  "aria-label": "Next page",
671
- children: /* @__PURE__ */ (0, O.jsx)(_e, { className: "size-4" })
672
+ children: /* @__PURE__ */ (0, O.jsx)(T, { className: "size-4" })
672
673
  })
673
674
  ]
674
675
  })]
675
676
  })
676
677
  ] }),
677
- r && /* @__PURE__ */ (0, O.jsx)(f, { children: /* @__PURE__ */ (0, O.jsxs)("div", {
678
+ i && /* @__PURE__ */ (0, O.jsx)(f, { children: /* @__PURE__ */ (0, O.jsxs)("div", {
678
679
  className: "flex items-center gap-2 w-full justify-between",
679
680
  children: [/* @__PURE__ */ (0, O.jsxs)("span", {
680
681
  className: "text-sm text-muted-foreground",
@@ -699,17 +700,17 @@ function M({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r =
699
700
  }
700
701
  //#endregion
701
702
  //#region ../fields/src/widgets/_cell-renderer-bridge.ts
702
- var N;
703
- function P(e) {
704
- N = e;
703
+ var P;
704
+ function F(e) {
705
+ P = e;
705
706
  }
706
- function Te() {
707
- return N;
707
+ function I() {
708
+ return P;
708
709
  }
709
710
  //#endregion
710
711
  //#region ../fields/src/widgets/LookupField.tsx
711
- var F = /* @__PURE__ */ e({ LookupField: () => L }), Ee = 50, De = x;
712
- function I(e, t, n, r) {
712
+ var we = 50, Te = x;
713
+ function Ee(e, t, n, r) {
713
714
  let i = e[n] ?? e.id ?? e._id, a = e[t] ?? e.label ?? e.name ?? String(i), ee = r ? e[r] : void 0;
714
715
  return {
715
716
  value: i,
@@ -718,7 +719,7 @@ function I(e, t, n, r) {
718
719
  ...e
719
720
  };
720
721
  }
721
- function Oe(e) {
722
+ function L(e) {
722
723
  return {
723
724
  text: "text",
724
725
  number: "number",
@@ -731,12 +732,12 @@ function Oe(e) {
731
732
  boolean: "boolean"
732
733
  }[e];
733
734
  }
734
- function L({ value: e, onChange: t, field: n, readonly: te, ...ne }) {
735
- let [re, f] = l(!1), [p, ie] = l(""), [h, ce] = l([]), [le, ue] = l(!1), [de, fe] = l(null), [g, pe] = l(0), _ = c(null), [v, me] = l([]), [y, b] = l(-1), he = c(null), x = n || ne.schema, S = x?.field, C = S && typeof S == "object" && ("reference_to" in S || "reference" in S || "type" in S) ? S : x, ge = C?.options || [], w = C?.multiple || !1, T = C?.display_field || C?.reference_field || "name", _e = C?.description_field, E = C?.id_field || "id", k = C?.reference_to || C?.reference, xe = C?.lookup_columns, Se = C?.lookup_page_size, Ce = C?.lookup_filters, A = s(() => {
736
- if (!xe) return;
735
+ function R({ value: e, onChange: t, field: te, readonly: ne, ...re }) {
736
+ let [f, p] = l(!1), [m, g] = l(""), { t: se } = i(), [ce, le] = l([]), [ue, de] = l(!1), [_, fe] = l(null), [v, pe] = l(0), y = c(null), [me, he] = l([]), [b, x] = l(-1), ge = c(null), S = te || re.schema, C = S?.field, w = C && typeof C == "object" && ("reference_to" in C || "reference" in C || "type" in C) ? C : S, _e = w?.options || [], T = w?.multiple || !1, E = w?.display_field || w?.reference_field || "name", xe = w?.description_field, k = w?.id_field || "id", A = w?.reference_to || w?.reference, j = w?.lookup_columns, M = w?.lookup_page_size, Se = w?.lookup_filters, Ce = s(() => {
737
+ if (!j) return;
737
738
  let e = [];
738
- for (let t of xe) if (typeof t == "object" && t.type) {
739
- let n = Oe(t.type);
739
+ for (let t of j) if (typeof t == "object" && t.type) {
740
+ let n = L(t.type);
740
741
  n && e.push({
741
742
  field: t.field,
742
743
  label: t.label,
@@ -744,123 +745,123 @@ function L({ value: e, onChange: t, field: n, readonly: te, ...ne }) {
744
745
  });
745
746
  }
746
747
  return e.length > 0 ? e : void 0;
747
- }, [xe]), we = ee(De)?.dataSource ?? null, j = ne.dataSource ?? x?.dataSource ?? C?.dataSource ?? we, N = j != null && typeof j.find == "function" && !!k, P = ne.onCreateNew ?? x?.onCreateNew, [F, L] = l(!1), R = N ? h : ge, z = s(() => {
748
- if (N || !p) return R;
749
- let e = p.toLowerCase();
750
- return R.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
748
+ }, [j]), P = ee(Te)?.dataSource ?? null, F = re.dataSource ?? S?.dataSource ?? w?.dataSource ?? P, R = F != null && typeof F.find == "function" && !!A, z = re.onCreateNew ?? S?.onCreateNew, [De, B] = l(!1), V = R ? ce : _e, H = s(() => {
749
+ if (R || !m) return V;
750
+ let e = m.toLowerCase();
751
+ return V.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
751
752
  }, [
752
- N,
753
753
  R,
754
- p
754
+ V,
755
+ m
755
756
  ]);
756
757
  o(() => {
757
- b(-1);
758
- }, [z.length]);
759
- let B = a(async (e) => {
760
- if (!(!j || !k)) {
761
- ue(!0), fe(null);
758
+ x(-1);
759
+ }, [H.length]);
760
+ let Oe = a(async (e) => {
761
+ if (!(!F || !A)) {
762
+ de(!0), fe(null);
762
763
  try {
763
- let t = { $top: Ee };
764
+ let t = { $top: we };
764
765
  e && e.trim() && (t.$search = e.trim());
765
- let n = await j.find(k, t), r = n?.data ?? n ?? [];
766
- ce(r.map((e) => I(e, T, E, _e))), pe(n?.total ?? r.length);
766
+ let n = await F.find(A, t), r = n?.data ?? n ?? [];
767
+ le(r.map((e) => Ee(e, E, k, xe))), pe(n?.total ?? r.length);
767
768
  } catch (e) {
768
- fe(e instanceof Error ? e.message : String(e)), ce([]);
769
+ fe(e instanceof Error ? e.message : String(e)), le([]);
769
770
  } finally {
770
- ue(!1);
771
+ de(!1);
771
772
  }
772
773
  }
773
774
  }, [
774
- j,
775
- k,
776
- T,
775
+ F,
776
+ A,
777
777
  E,
778
- _e
778
+ k,
779
+ xe
779
780
  ]);
780
781
  o(() => {
781
- re && N && B(p || void 0), re || (ie(""), fe(null), b(-1));
782
- }, [re]);
783
- let V = a((e) => {
784
- ie(e), N && (_.current && clearTimeout(_.current), _.current = setTimeout(() => {
785
- B(e || void 0);
782
+ f && R && Oe(m || void 0), f || (g(""), fe(null), x(-1));
783
+ }, [f]);
784
+ let ke = a((e) => {
785
+ g(e), R && (y.current && clearTimeout(y.current), y.current = setTimeout(() => {
786
+ Oe(e || void 0);
786
787
  }, 300));
787
- }, [N, B]);
788
+ }, [R, Oe]);
788
789
  o(() => () => {
789
- _.current && clearTimeout(_.current);
790
+ y.current && clearTimeout(y.current);
790
791
  }, []);
791
- let ke = a((e) => ge.find((t) => t.value === e) ?? h.find((t) => t.value === e) ?? v.find((t) => t.value === e), [
792
- ge,
793
- h,
794
- v
795
- ]), H = w ? (Array.isArray(e) ? e : []).map(ke).filter(Boolean) : e ? [ke(e)].filter(Boolean) : [], Ae = a((n) => {
796
- if (w) {
792
+ let Ae = a((e) => _e.find((t) => t.value === e) ?? ce.find((t) => t.value === e) ?? me.find((t) => t.value === e), [
793
+ _e,
794
+ ce,
795
+ me
796
+ ]), U = T ? (Array.isArray(e) ? e : []).map(Ae).filter(Boolean) : e ? [Ae(e)].filter(Boolean) : [], W = a((n) => {
797
+ if (T) {
797
798
  let r = Array.isArray(e) ? e : [];
798
799
  r.includes(n.value) ? t(r.filter((e) => e !== n.value)) : t([...r, n.value]);
799
- } else t(n.value), f(!1);
800
+ } else t(n.value), p(!1);
800
801
  }, [
801
- w,
802
+ T,
802
803
  e,
803
804
  t
804
- ]), U = (n) => {
805
- t(w ? (Array.isArray(e) ? e : []).filter((e) => e !== n) : null);
806
- }, W = a((e) => {
807
- me(e.map((e) => I(e, T, E, _e)));
805
+ ]), G = (n) => {
806
+ t(T ? (Array.isArray(e) ? e : []).filter((e) => e !== n) : null);
807
+ }, K = a((e) => {
808
+ he(e.map((e) => Ee(e, E, k, xe)));
808
809
  }, [
809
- T,
810
810
  E,
811
- _e
812
- ]), G = a((e) => {
813
- e.key === "ArrowDown" ? (e.preventDefault(), b((e) => e < z.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), b((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), y >= 0 && y < z.length && Ae(z[y]));
811
+ k,
812
+ xe
813
+ ]), je = a((e) => {
814
+ e.key === "ArrowDown" ? (e.preventDefault(), x((e) => e < H.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), x((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), b >= 0 && b < H.length && W(H[b]));
814
815
  }, [
815
- z,
816
- y,
817
- Ae
816
+ H,
817
+ b,
818
+ W
818
819
  ]);
819
820
  return o(() => {
820
- y >= 0 && he.current && he.current.querySelector(`[data-lookup-index="${y}"]`)?.scrollIntoView({ block: "nearest" });
821
- }, [y]), te ? H.length ? w ? /* @__PURE__ */ (0, O.jsx)("div", {
821
+ b >= 0 && ge.current && ge.current.querySelector(`[data-lookup-index="${b}"]`)?.scrollIntoView({ block: "nearest" });
822
+ }, [b]), ne ? U.length ? T ? /* @__PURE__ */ (0, O.jsx)("div", {
822
823
  className: "flex flex-wrap gap-1",
823
- children: H.map((e, t) => /* @__PURE__ */ (0, O.jsx)(u, {
824
+ children: U.map((e, t) => /* @__PURE__ */ (0, O.jsx)(u, {
824
825
  variant: "outline",
825
- children: e?.[T] || e?.label
826
+ children: e?.[E] || e?.label
826
827
  }, t))
827
828
  }) : /* @__PURE__ */ (0, O.jsx)("span", {
828
829
  className: "text-sm",
829
- children: H[0]?.[T] || H[0]?.label
830
+ children: U[0]?.[E] || U[0]?.label
830
831
  }) : /* @__PURE__ */ (0, O.jsx)("span", {
831
832
  className: "text-sm",
832
833
  children: "-"
833
834
  }) : /* @__PURE__ */ (0, O.jsxs)("div", {
834
835
  className: "space-y-2",
835
836
  children: [
836
- H.length > 0 && /* @__PURE__ */ (0, O.jsx)("div", {
837
+ U.length > 0 && /* @__PURE__ */ (0, O.jsx)("div", {
837
838
  className: "flex flex-wrap gap-1",
838
- children: H.map((e, t) => /* @__PURE__ */ (0, O.jsxs)(u, {
839
+ children: U.map((e, t) => /* @__PURE__ */ (0, O.jsxs)(u, {
839
840
  variant: "outline",
840
841
  className: "gap-1",
841
- children: [e?.[T] || e?.label, /* @__PURE__ */ (0, O.jsx)("button", {
842
- onClick: () => U(e?.value),
842
+ children: [e?.[E] || e?.label, /* @__PURE__ */ (0, O.jsx)("button", {
843
+ onClick: () => G(e?.value),
843
844
  className: "ml-1 hover:text-destructive",
844
845
  type: "button",
845
- "aria-label": `Remove ${e?.[T] || e?.label}`,
846
- children: /* @__PURE__ */ (0, O.jsx)(i, { className: "size-3" })
846
+ "aria-label": `Remove ${e?.[E] || e?.label}`,
847
+ children: /* @__PURE__ */ (0, O.jsx)(r, { className: "size-3" })
847
848
  })]
848
849
  }, t))
849
850
  }),
850
851
  /* @__PURE__ */ (0, O.jsxs)("div", {
851
852
  className: "flex items-center gap-1.5",
852
- children: [/* @__PURE__ */ (0, O.jsxs)(ae, {
853
- open: re,
854
- onOpenChange: f,
855
- children: [/* @__PURE__ */ (0, O.jsx)(se, {
853
+ children: [/* @__PURE__ */ (0, O.jsxs)(ie, {
854
+ open: f,
855
+ onOpenChange: p,
856
+ children: [/* @__PURE__ */ (0, O.jsx)(oe, {
856
857
  asChild: !0,
857
858
  children: /* @__PURE__ */ (0, O.jsxs)(d, {
858
859
  variant: "outline",
859
860
  className: "min-w-0 flex-1 justify-start text-left font-normal",
860
861
  type: "button",
861
- children: [/* @__PURE__ */ (0, O.jsx)(be, { className: "mr-2 size-4" }), H.length === 0 ? x?.placeholder || "Select..." : w ? `${H.length} selected` : "Change selection"]
862
+ children: [/* @__PURE__ */ (0, O.jsx)(be, { className: "mr-2 size-4" }), U.length === 0 ? S?.placeholder || se("common.select") : T ? se("table.selected", { count: U.length }) : se("common.select")]
862
863
  })
863
- }), /* @__PURE__ */ (0, O.jsxs)(oe, {
864
+ }), /* @__PURE__ */ (0, O.jsxs)(ae, {
864
865
  className: "w-[var(--radix-popover-trigger-width)] p-0",
865
866
  align: "start",
866
867
  children: [
@@ -870,39 +871,39 @@ function L({ value: e, onChange: t, field: n, readonly: te, ...ne }) {
870
871
  className: "relative",
871
872
  children: [
872
873
  /* @__PURE__ */ (0, O.jsx)(be, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
873
- /* @__PURE__ */ (0, O.jsx)(m, {
874
- placeholder: "Search...",
875
- value: p,
876
- onChange: (e) => V(e.target.value),
877
- onKeyDown: G,
874
+ /* @__PURE__ */ (0, O.jsx)(h, {
875
+ placeholder: se("common.search") + "...",
876
+ value: m,
877
+ onChange: (e) => ke(e.target.value),
878
+ onKeyDown: je,
878
879
  className: "w-full pl-9 h-8 text-sm"
879
880
  }),
880
- le && /* @__PURE__ */ (0, O.jsx)(ye, {
881
+ ue && /* @__PURE__ */ (0, O.jsx)(ye, {
881
882
  className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
882
883
  "data-testid": "lookup-loading"
883
884
  })
884
885
  ]
885
886
  })
886
887
  }),
887
- de && /* @__PURE__ */ (0, O.jsxs)("div", {
888
+ _ && /* @__PURE__ */ (0, O.jsxs)("div", {
888
889
  className: "flex flex-col items-center gap-2 py-4 px-2",
889
890
  role: "alert",
890
891
  children: [
891
892
  /* @__PURE__ */ (0, O.jsx)(ve, { className: "size-5 text-destructive" }),
892
893
  /* @__PURE__ */ (0, O.jsx)("p", {
893
894
  className: "text-sm text-destructive",
894
- children: de
895
+ children: _
895
896
  }),
896
897
  /* @__PURE__ */ (0, O.jsx)(d, {
897
898
  variant: "outline",
898
899
  size: "sm",
899
- onClick: () => B(p || void 0),
900
+ onClick: () => Oe(m || void 0),
900
901
  type: "button",
901
902
  children: "Retry"
902
903
  })
903
904
  ]
904
905
  }),
905
- le && z.length === 0 && !de && /* @__PURE__ */ (0, O.jsxs)("div", {
906
+ ue && H.length === 0 && !_ && /* @__PURE__ */ (0, O.jsxs)("div", {
906
907
  className: "flex flex-col items-center gap-2 py-6",
907
908
  role: "status",
908
909
  "aria-live": "polite",
@@ -911,34 +912,34 @@ function L({ value: e, onChange: t, field: n, readonly: te, ...ne }) {
911
912
  children: "Loading…"
912
913
  })]
913
914
  }),
914
- !de && !(le && z.length === 0) && /* @__PURE__ */ (0, O.jsx)("div", {
915
- ref: he,
915
+ !_ && !(ue && H.length === 0) && /* @__PURE__ */ (0, O.jsx)("div", {
916
+ ref: ge,
916
917
  className: "max-h-64 overflow-y-auto px-1 pb-1",
917
918
  role: "listbox",
918
- children: z.length === 0 ? /* @__PURE__ */ (0, O.jsxs)("div", {
919
+ children: H.length === 0 ? /* @__PURE__ */ (0, O.jsxs)("div", {
919
920
  className: "py-4 text-center",
920
921
  children: [/* @__PURE__ */ (0, O.jsx)("p", {
921
922
  className: "text-sm text-muted-foreground",
922
923
  children: "No options found"
923
- }), P && /* @__PURE__ */ (0, O.jsxs)(d, {
924
+ }), z && /* @__PURE__ */ (0, O.jsxs)(d, {
924
925
  variant: "ghost",
925
926
  size: "sm",
926
927
  className: "mt-2 gap-1",
927
928
  type: "button",
928
929
  onClick: () => {
929
- P(p), f(!1);
930
+ z(m), p(!1);
930
931
  },
931
- children: [/* @__PURE__ */ (0, O.jsx)(r, { className: "size-4" }), "Create new"]
932
+ children: [/* @__PURE__ */ (0, O.jsx)(n, { className: "size-4" }), "Create new"]
932
933
  })]
933
934
  }) : /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [
934
- z.map((t, n) => {
935
- let r = w ? (Array.isArray(e) ? e : []).includes(t.value) : e === t.value, i = n === y;
935
+ H.map((t, n) => {
936
+ let r = T ? (Array.isArray(e) ? e : []).includes(t.value) : e === t.value;
936
937
  return /* @__PURE__ */ (0, O.jsxs)("button", {
937
938
  "data-lookup-index": n,
938
939
  role: "option",
939
940
  "aria-selected": r,
940
- onClick: () => Ae(t),
941
- className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${i ? "bg-accent text-accent-foreground" : r ? "bg-accent/50 text-accent-foreground" : ""}`,
941
+ onClick: () => W(t),
942
+ className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${n === b ? "bg-accent text-accent-foreground" : r ? "bg-accent/50 text-accent-foreground" : ""}`,
942
943
  type: "button",
943
944
  children: [/* @__PURE__ */ (0, O.jsxs)("div", {
944
945
  className: "min-w-0 flex-1",
@@ -956,78 +957,78 @@ function L({ value: e, onChange: t, field: n, readonly: te, ...ne }) {
956
957
  })]
957
958
  }, t.value);
958
959
  }),
959
- N && g > z.length && /* @__PURE__ */ (0, O.jsxs)("p", {
960
+ R && v > H.length && /* @__PURE__ */ (0, O.jsxs)("p", {
960
961
  className: "text-xs text-muted-foreground text-center py-2",
961
962
  children: [
962
963
  "Showing ",
963
- z.length,
964
+ H.length,
964
965
  " of ",
965
- g,
966
+ v,
966
967
  " results."
967
968
  ]
968
969
  }),
969
- N && g > z.length && /* @__PURE__ */ (0, O.jsxs)("button", {
970
+ R && v > H.length && /* @__PURE__ */ (0, O.jsxs)("button", {
970
971
  type: "button",
971
972
  className: "w-full text-center px-3 py-2 rounded-md text-sm font-medium text-primary hover:bg-accent flex items-center justify-center gap-1.5",
972
973
  onClick: () => {
973
- f(!1), L(!0);
974
+ p(!1), B(!0);
974
975
  },
975
976
  "data-testid": "show-all-results",
976
977
  children: [
977
978
  /* @__PURE__ */ (0, O.jsx)(D, { className: "size-3.5" }),
978
979
  "Show All Results (",
979
- g,
980
+ v,
980
981
  ")"
981
982
  ]
982
983
  }),
983
- P && /* @__PURE__ */ (0, O.jsxs)("button", {
984
+ z && /* @__PURE__ */ (0, O.jsxs)("button", {
984
985
  type: "button",
985
986
  className: "w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center gap-1.5 text-muted-foreground",
986
987
  onClick: () => {
987
- P(p), f(!1);
988
+ z(m), p(!1);
988
989
  },
989
990
  children: [
990
- /* @__PURE__ */ (0, O.jsx)(r, { className: "size-3.5" }),
991
+ /* @__PURE__ */ (0, O.jsx)(n, { className: "size-3.5" }),
991
992
  "Create new",
992
- p ? ` "${p}"` : ""
993
+ m ? ` "${m}"` : ""
993
994
  ]
994
995
  })
995
996
  ] })
996
997
  })
997
998
  ]
998
999
  })]
999
- }), N && /* @__PURE__ */ (0, O.jsx)(d, {
1000
+ }), R && /* @__PURE__ */ (0, O.jsx)(d, {
1000
1001
  variant: "outline",
1001
1002
  size: "icon",
1002
1003
  className: "shrink-0",
1003
1004
  type: "button",
1004
- onClick: () => L(!0),
1005
+ onClick: () => B(!0),
1005
1006
  "aria-label": "Browse all records",
1006
1007
  title: "Browse all records",
1007
1008
  "data-testid": "browse-all-records",
1008
1009
  children: /* @__PURE__ */ (0, O.jsx)(D, { className: "size-4" })
1009
1010
  })]
1010
1011
  }),
1011
- N && j && k && /* @__PURE__ */ (0, O.jsx)(M, {
1012
- open: F,
1013
- onOpenChange: L,
1014
- title: x?.label || "Select",
1015
- multiple: w,
1016
- dataSource: j,
1017
- objectName: k,
1018
- columns: xe,
1019
- displayField: T,
1020
- idField: E,
1021
- pageSize: Se,
1012
+ R && F && A && /* @__PURE__ */ (0, O.jsx)(N, {
1013
+ open: De,
1014
+ onOpenChange: B,
1015
+ title: S?.label || "Select",
1016
+ multiple: T,
1017
+ dataSource: F,
1018
+ objectName: A,
1019
+ columns: j,
1020
+ displayField: E,
1021
+ idField: k,
1022
+ pageSize: M,
1022
1023
  value: e,
1023
1024
  onSelect: t,
1024
- onSelectRecords: W,
1025
- lookupFilters: Ce,
1026
- cellRenderer: Te(),
1027
- filterColumns: A
1025
+ onSelectRecords: K,
1026
+ lookupFilters: Se,
1027
+ cellRenderer: I(),
1028
+ filterColumns: Ce
1028
1029
  })
1029
1030
  ]
1030
1031
  });
1031
1032
  }
1032
1033
  //#endregion
1033
- export { w as i, F as n, P as r, L as t };
1034
+ export { F as n, w as r, R as t };