@object-ui/plugin-aggrid 3.3.1 → 3.4.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 (55) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/{AvatarField-CpFxJRdO.js → AvatarField-DuaF__ns.js} +2 -2
  3. package/dist/FileField-DtvoWRK-.js +214 -0
  4. package/dist/{GeolocationField-BfhC7QLw.js → GeolocationField-CyzG2dqR.js} +1 -1
  5. package/dist/ImageCropperDialog-BFlbM7vO.js +153 -0
  6. package/dist/ImageField-DoXNtXV_.js +145 -0
  7. package/dist/LookupField-DXGCnQ3q.js +1063 -0
  8. package/dist/{MasterDetailField-DGUmvg2f.js → MasterDetailField-JpmMudRV.js} +3 -3
  9. package/dist/{ObjectAgGridImpl-yiHlXYgp.js → ObjectAgGridImpl-Bz5whFec.js} +110 -108
  10. package/dist/{PasswordField-BJboeBJY.js → PasswordField-40E439oE.js} +1 -1
  11. package/dist/{QRCodeField-COLyc5iQ.js → QRCodeField-CrRsA1vB.js} +1 -1
  12. package/dist/{RatingField-B2momIna.js → RatingField-BVkroiQ4.js} +1 -1
  13. package/dist/{SelectField-oo6vnNhQ.js → SelectField-K-xoVDss.js} +1 -1
  14. package/dist/{SignatureField-DUgoK09r.js → SignatureField-D0nUx3Cb.js} +1 -1
  15. package/dist/TextAreaField-j4eJQ66C.js +125 -0
  16. package/dist/{UserField-eT5njHwQ.js → UserField-LrhYdvnz.js} +1 -1
  17. package/dist/check-CBAnx5TO.js +7 -0
  18. package/dist/{createLucideIcon-C_5JZ35b.js → createLucideIcon-BtZxPlua.js} +1 -1
  19. package/dist/crop-2wjrXKXD.js +10 -0
  20. package/dist/dist-BcXWTU-8.js +54 -0
  21. package/dist/index.js +1 -1
  22. package/dist/index.umd.cjs +79 -79
  23. package/dist/loader-circle-Cxg-xF4u.js +7 -0
  24. package/dist/{plus-bvZ2f9T_.js → plus-COkdZ2Fh.js} +1 -1
  25. package/dist/{upload-BdzwEMeV.js → upload-DWhfIa3Y.js} +1 -1
  26. package/dist/{x-98xe-fYG.js → x-BDi_yYx9.js} +1 -1
  27. package/package.json +9 -9
  28. package/dist/FileField-D3mZIrJ1.js +0 -158
  29. package/dist/ImageField-BZfSFwmJ.js +0 -75
  30. package/dist/LookupField-Cms1Cu_l.js +0 -1032
  31. package/dist/TextAreaField-CLzzmPce.js +0 -37
  32. package/dist/image-DmzU2ETO.js +0 -24
  33. /package/dist/{AgGridImpl-DJWnS8p3.js → AgGridImpl-DiTsK8F6.js} +0 -0
  34. /package/dist/{BooleanField-Chphr8cB.js → BooleanField-0QUz5DOy.js} +0 -0
  35. /package/dist/{CodeField-BWngVIw1.js → CodeField-iTabv7wS.js} +0 -0
  36. /package/dist/{ColorField-GygyYArR.js → ColorField-R7ZmLj1V.js} +0 -0
  37. /package/dist/{CurrencyField-O8Pn59RO.js → CurrencyField-CEu2SjEj.js} +0 -0
  38. /package/dist/{DateField-u6U8wmvI.js → DateField-DoaPu9GV.js} +0 -0
  39. /package/dist/{DateTimeField-D1z1Ovvy.js → DateTimeField-DcKX54zr.js} +0 -0
  40. /package/dist/{EmailField-IOcDmGjJ.js → EmailField-eYfpFAtE.js} +0 -0
  41. /package/dist/{FormulaField-MuyWzQx0.js → FormulaField-DF6-4u2b.js} +0 -0
  42. /package/dist/{GridField-gN34gk4b.js → GridField-BFlgbp8W.js} +0 -0
  43. /package/dist/{LocationField-B-zwfw3h.js → LocationField-BeYK6K9V.js} +0 -0
  44. /package/dist/{NumberField-BV5sKwZ7.js → NumberField-BYuCxbmU.js} +0 -0
  45. /package/dist/{ObjectField-DJ5s3ciA.js → ObjectField-Dlf_yrMC.js} +0 -0
  46. /package/dist/{PercentField-DO3be_bL.js → PercentField-BvdQEcfn.js} +0 -0
  47. /package/dist/{PhoneField-CT6XcO6O.js → PhoneField-CBuoC-vs.js} +0 -0
  48. /package/dist/{RichTextField-C7qzDPJy.js → RichTextField-DEYNcokk.js} +0 -0
  49. /package/dist/{SliderField-DrggtBSX.js → SliderField-C2EpGbj8.js} +0 -0
  50. /package/dist/{SummaryField-DuMsFoY5.js → SummaryField-S6Gt7IDC.js} +0 -0
  51. /package/dist/{TextField-CZE7SzK4.js → TextField-DccUZtd7.js} +0 -0
  52. /package/dist/{TimeField-Bha4cayv.js → TimeField-CWbpycPt.js} +0 -0
  53. /package/dist/{UrlField-Dff4WLlN.js → UrlField-BkPyImh9.js} +0 -0
  54. /package/dist/{VectorField-BHe8lDOH.js → VectorField-Baa_mHsO.js} +0 -0
  55. /package/dist/{useFieldTranslation-CfXaJRC4.js → useFieldTranslation-DtLNhrx3.js} +0 -0
@@ -1,1032 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CkxV0rQ3.js";
2
- import { t } from "./jsx-runtime-CXSCp6pT.js";
3
- import { t as n } from "./createLucideIcon-C_5JZ35b.js";
4
- import { t as r } from "./plus-bvZ2f9T_.js";
5
- import { t as i } from "./x-98xe-fYG.js";
6
- import { t as ee } from "./useFieldTranslation-CfXaJRC4.js";
7
- import { useCallback as a, useContext as te, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
8
- import { Badge as u, Button as d, Checkbox as ne, Dialog as re, DialogContent as ie, DialogFooter as f, DialogHeader as p, DialogTitle as ae, EmptyValue as oe, Input as m, Label as h, Popover as se, PopoverContent as g, PopoverTrigger as _, Select as ce, SelectContent as le, SelectItem as ue, SelectTrigger as de, SelectValue as fe, Skeleton as v, Table as y, TableBody as pe, TableCell as b, TableHead as x, TableHeader as me, TableRow as S, cn as he } from "@object-ui/components";
9
- import { SchemaRendererContext as C } from "@object-ui/react";
10
- var w = n("arrow-down", [["path", {
11
- d: "M12 5v14",
12
- key: "s699le"
13
- }], ["path", {
14
- d: "m19 12-7 7-7-7",
15
- key: "1idqje"
16
- }]]), T = n("arrow-up-down", [
17
- ["path", {
18
- d: "m21 16-4 4-4-4",
19
- key: "f6ql7i"
20
- }],
21
- ["path", {
22
- d: "M17 20V4",
23
- key: "1ejh1v"
24
- }],
25
- ["path", {
26
- d: "m3 8 4-4 4 4",
27
- key: "11wl7u"
28
- }],
29
- ["path", {
30
- d: "M7 4v16",
31
- key: "1glfcx"
32
- }]
33
- ]), E = n("arrow-up", [["path", {
34
- d: "m5 12 7-7 7 7",
35
- key: "hav0vg"
36
- }], ["path", {
37
- d: "M12 19V5",
38
- key: "x0mq9r"
39
- }]]), ge = n("check", [["path", {
40
- d: "M20 6 9 17l-5-5",
41
- key: "1gmf2c"
42
- }]]), D = n("chevron-left", [["path", {
43
- d: "m15 18-6-6 6-6",
44
- key: "1wnfg3"
45
- }]]), O = n("chevron-right", [["path", {
46
- d: "m9 18 6-6-6-6",
47
- key: "mthhwq"
48
- }]]), _e = n("circle-alert", [
49
- ["circle", {
50
- cx: "12",
51
- cy: "12",
52
- r: "10",
53
- key: "1mglay"
54
- }],
55
- ["line", {
56
- x1: "12",
57
- x2: "12",
58
- y1: "8",
59
- y2: "12",
60
- key: "1pkeuh"
61
- }],
62
- ["line", {
63
- x1: "12",
64
- x2: "12.01",
65
- y1: "16",
66
- y2: "16",
67
- key: "4dfq90"
68
- }]
69
- ]), ve = n("loader-circle", [["path", {
70
- d: "M21 12a9 9 0 1 1-6.219-8.56",
71
- key: "13zald"
72
- }]]), ye = n("search", [["path", {
73
- d: "m21 21-4.34-4.34",
74
- key: "14j7rj"
75
- }], ["circle", {
76
- cx: "11",
77
- cy: "11",
78
- r: "8",
79
- key: "4ej97u"
80
- }]]), be = n("sliders-horizontal", [
81
- ["path", {
82
- d: "M10 5H3",
83
- key: "1qgfaw"
84
- }],
85
- ["path", {
86
- d: "M12 19H3",
87
- key: "yhmn1j"
88
- }],
89
- ["path", {
90
- d: "M14 3v4",
91
- key: "1sua03"
92
- }],
93
- ["path", {
94
- d: "M16 17v4",
95
- key: "1q0r14"
96
- }],
97
- ["path", {
98
- d: "M21 12h-9",
99
- key: "1o4lsq"
100
- }],
101
- ["path", {
102
- d: "M21 19h-5",
103
- key: "1rlt1p"
104
- }],
105
- ["path", {
106
- d: "M21 5h-7",
107
- key: "1oszz2"
108
- }],
109
- ["path", {
110
- d: "M8 10v4",
111
- key: "tgpxqk"
112
- }],
113
- ["path", {
114
- d: "M8 12H3",
115
- key: "a7s4jb"
116
- }]
117
- ]), k = n("table-properties", [
118
- ["path", {
119
- d: "M15 3v18",
120
- key: "14nvp0"
121
- }],
122
- ["rect", {
123
- width: "18",
124
- height: "18",
125
- x: "3",
126
- y: "3",
127
- rx: "2",
128
- key: "afitv7"
129
- }],
130
- ["path", {
131
- d: "M21 9H3",
132
- key: "1338ky"
133
- }],
134
- ["path", {
135
- d: "M21 15H3",
136
- key: "9uk58r"
137
- }]
138
- ]), A = t(), j = 10, M = 60, xe = 5;
139
- function Se(e) {
140
- return typeof e == "string" ? { field: e } : e;
141
- }
142
- function Ce(e) {
143
- return e.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (e) => e.toUpperCase());
144
- }
145
- function we(e) {
146
- let t = {};
147
- for (let n of e) switch (n.operator) {
148
- case "eq":
149
- t[n.field] = n.value;
150
- break;
151
- case "ne":
152
- t[n.field] = { $ne: n.value };
153
- break;
154
- case "gt":
155
- t[n.field] = { $gt: n.value };
156
- break;
157
- case "lt":
158
- t[n.field] = { $lt: n.value };
159
- break;
160
- case "gte":
161
- t[n.field] = { $gte: n.value };
162
- break;
163
- case "lte":
164
- t[n.field] = { $lte: n.value };
165
- break;
166
- case "contains":
167
- t[n.field] = { $contains: n.value };
168
- break;
169
- case "in":
170
- t[n.field] = { $in: n.value };
171
- break;
172
- case "notIn":
173
- t[n.field] = { $nin: n.value };
174
- break;
175
- }
176
- return t;
177
- }
178
- function Te(e, t) {
179
- let n = {};
180
- for (let r of t) {
181
- let t = e[r.field];
182
- t == null || t === "" || (r.type === "boolean" ? n[r.field] = !!t : r.type === "text" ? n[r.field] = { $contains: t } : n[r.field] = t);
183
- }
184
- return n;
185
- }
186
- function N({ open: e, onOpenChange: t, title: n = "Select Record", multiple: r = !1, dataSource: ee, objectName: te, columns: u, displayField: oe = "name", idField: se = "id", pageSize: g = j, value: _, onSelect: C, onSelectRecords: k, lookupFilters: N, cellRenderer: P, filterColumns: F, renderFilterBar: Ee, renderGrid: I }) {
187
- let [L, De] = l([]), [R, Oe] = l(!1), [z, B] = l(null), [V, H] = l(0), [U, ke] = l(""), [W, G] = l(1), K = c(null), [q, Ae] = l(null), [J, je] = l("asc"), [Me, Ne] = l(/* @__PURE__ */ new Set()), Pe = c(/* @__PURE__ */ new Map()), [Y, Fe] = l(-1), Ie = c(null), [Le, Re] = l(!1), [X, ze] = l({}), [Be, Ve] = l({}), He = c(null), [Ue, We] = l(""), Ge = s(() => u && u.length > 0 ? u.map(Se) : [{
188
- field: oe,
189
- label: Ce(oe)
190
- }], [u, oe]), Z = s(() => {
191
- if (F && F.length > 0) return F;
192
- if (N && N.length > 0) return N.map((e) => {
193
- let t = "text";
194
- 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"), {
195
- field: e.field,
196
- label: Ce(e.field),
197
- type: t,
198
- ...Array.isArray(e.value) ? { options: e.value.map((e) => {
199
- if (typeof e == "object" && e) {
200
- let t = e;
201
- return {
202
- label: String(t.name || t.label || t.title || e),
203
- value: e
204
- };
205
- }
206
- return {
207
- label: String(e),
208
- value: e
209
- };
210
- }) } : {}
211
- };
212
- });
213
- }, [F, N]), Ke = s(() => {
214
- let e = N?.length ? we(N) : {}, t = Z?.length ? Te(X, Z) : {}, n = {
215
- ...e,
216
- ...t
217
- };
218
- return Object.keys(n).length > 0 ? n : void 0;
219
- }, [
220
- N,
221
- Z,
222
- X
223
- ]), Q = Math.max(1, Math.ceil(V / g)), qe = a(async (e, t = 1, n, r) => {
224
- if (!(!ee || !te)) {
225
- Oe(!0), B(null);
226
- try {
227
- let i = {
228
- $top: g,
229
- $skip: (t - 1) * g
230
- };
231
- e && e.trim() && (i.$search = e.trim()), n && (i.$orderby = { [n.field]: n.direction });
232
- let a = r === void 0 ? Ke : r;
233
- a && Object.keys(a).length > 0 && (i.$filter = a);
234
- let o = await ee.find(te, i), s = o?.data ?? o ?? [];
235
- De(s), H(o?.total ?? s.length), Fe(-1);
236
- } catch (e) {
237
- B(e instanceof Error ? e.message : String(e)), De([]);
238
- } finally {
239
- Oe(!1);
240
- }
241
- }
242
- }, [
243
- ee,
244
- te,
245
- g,
246
- Ke
247
- ]), Je = s(() => q ? {
248
- field: q,
249
- direction: J
250
- } : null, [q, J]);
251
- o(() => {
252
- e || (ke(""), G(1), B(null), De([]), Ae(null), je("asc"), Fe(-1), Re(!1), ze({}), Ve({}), We(""), Ne(new Set(r && Array.isArray(_) ? _ : [])), Pe.current.clear());
253
- }, [e]), o(() => {
254
- e && qe(U || void 0, W, Je);
255
- }, [
256
- e,
257
- W,
258
- Je,
259
- Ke
260
- ]), o(() => {
261
- e && r && Ne(new Set(Array.isArray(_) ? _ : []));
262
- }, [
263
- e,
264
- r,
265
- _
266
- ]);
267
- let Ye = a((e) => {
268
- ke(e), G(1), K.current && clearTimeout(K.current), K.current = setTimeout(() => {
269
- qe(e || void 0, 1, Je);
270
- }, 300);
271
- }, [qe, Je]);
272
- o(() => () => {
273
- K.current && clearTimeout(K.current);
274
- }, []);
275
- let Xe = a((e) => {
276
- Ae((t) => t === e ? (je((e) => e === "asc" ? "desc" : "asc"), e) : (je("asc"), e)), G(1);
277
- }, []), Ze = a((e) => e[se] ?? e.id ?? e._id, [se]), Qe = a((e) => {
278
- let t = Ze(e);
279
- return r ? Me.has(t) : _ === t;
280
- }, [
281
- r,
282
- _,
283
- Me,
284
- Ze
285
- ]), $e = a((e) => {
286
- let n = Ze(e);
287
- r ? Ne((t) => {
288
- let r = new Set(t);
289
- return r.has(n) ? (r.delete(n), Pe.current.delete(n)) : (r.add(n), Pe.current.set(n, e)), r;
290
- }) : (C(n), k?.([e]), t(!1));
291
- }, [
292
- r,
293
- Ze,
294
- C,
295
- k,
296
- t
297
- ]), et = a(() => {
298
- let e = Array.from(Me);
299
- C(e);
300
- let n = e.map((e) => Pe.current.get(e)).filter(Boolean);
301
- k?.(n), t(!1);
302
- }, [
303
- Me,
304
- C,
305
- k,
306
- t
307
- ]), tt = a(() => {
308
- G((e) => Math.max(1, e - 1));
309
- }, []), nt = a(() => {
310
- G((e) => Math.min(Q, e + 1));
311
- }, [Q]), rt = a((e) => {
312
- if (e.key !== "Enter") return;
313
- let t = parseInt(Ue, 10);
314
- !isNaN(t) && t >= 1 && t <= Q && G(t), We("");
315
- }, [Ue, Q]), it = a((e) => {
316
- L.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), Fe((e) => Math.min(e + 1, L.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), Fe((e) => Math.max(e - 1, 0))) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Y >= 0 && Y < L.length && $e(L[Y])));
317
- }, [
318
- L,
319
- Y,
320
- $e
321
- ]);
322
- o(() => {
323
- if (Y >= 0 && Ie.current) {
324
- let e = Ie.current.querySelector(`[data-row-index="${Y}"]`);
325
- e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
326
- }
327
- }, [Y]);
328
- let at = a((e, t) => {
329
- let n = e[t.field];
330
- if (t.type && P) {
331
- let e = P(t.type);
332
- if (e) return /* @__PURE__ */ (0, A.jsx)(e, {
333
- value: n,
334
- field: {
335
- name: t.field,
336
- type: t.type
337
- }
338
- });
339
- }
340
- 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);
341
- }, [P]), ot = a((e) => q === e ? J === "asc" ? /* @__PURE__ */ (0, A.jsx)(E, { className: "ml-1 size-3" }) : /* @__PURE__ */ (0, A.jsx)(w, { className: "ml-1 size-3" }) : /* @__PURE__ */ (0, A.jsx)(T, { className: "ml-1 size-3 opacity-40" }), [q, J]), st = a((e, t, n) => {
342
- e.preventDefault(), e.stopPropagation(), He.current = {
343
- field: t,
344
- startX: e.clientX,
345
- startWidth: n
346
- };
347
- let r = (e) => {
348
- if (!He.current) return;
349
- let t = e.clientX - He.current.startX, n = Math.max(M, He.current.startWidth + t);
350
- Ve((e) => ({
351
- ...e,
352
- [He.current.field]: n
353
- }));
354
- }, i = () => {
355
- He.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
356
- };
357
- document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
358
- }, []), $ = a((e, t) => {
359
- ze((n) => ({
360
- ...n,
361
- [e]: t
362
- })), G(1);
363
- }, []), ct = a(() => {
364
- ze({}), G(1);
365
- }, []), lt = s(() => Object.values(X).filter((e) => e != null && e !== "").length, [X]), ut = a((e) => {
366
- let t = X[e.field], n = e.label || Ce(e.field);
367
- switch (e.type) {
368
- case "select": return /* @__PURE__ */ (0, A.jsxs)("div", {
369
- className: "space-y-1",
370
- children: [/* @__PURE__ */ (0, A.jsx)(h, {
371
- className: "text-xs text-muted-foreground",
372
- children: n
373
- }), /* @__PURE__ */ (0, A.jsxs)(ce, {
374
- value: t == null ? "" : String(t),
375
- onValueChange: (t) => $(e.field, t),
376
- children: [/* @__PURE__ */ (0, A.jsx)(de, {
377
- className: "h-8 text-xs",
378
- children: /* @__PURE__ */ (0, A.jsx)(fe, { placeholder: `Filter ${n}` })
379
- }), /* @__PURE__ */ (0, A.jsx)(le, { children: e.options?.map((e) => /* @__PURE__ */ (0, A.jsx)(ue, {
380
- value: String(e.value),
381
- children: e.label
382
- }, String(e.value))) })]
383
- })]
384
- });
385
- case "number": return /* @__PURE__ */ (0, A.jsxs)("div", {
386
- className: "space-y-1",
387
- children: [/* @__PURE__ */ (0, A.jsx)(h, {
388
- className: "text-xs text-muted-foreground",
389
- children: n
390
- }), /* @__PURE__ */ (0, A.jsx)(m, {
391
- type: "number",
392
- className: "h-8 text-xs",
393
- value: t ?? "",
394
- placeholder: `Filter ${n}`,
395
- onChange: (t) => {
396
- let n = t.target.value;
397
- $(e.field, n === "" ? "" : Number(n));
398
- }
399
- })]
400
- });
401
- case "date": return /* @__PURE__ */ (0, A.jsxs)("div", {
402
- className: "space-y-1",
403
- children: [/* @__PURE__ */ (0, A.jsx)(h, {
404
- className: "text-xs text-muted-foreground",
405
- children: n
406
- }), /* @__PURE__ */ (0, A.jsx)(m, {
407
- type: "date",
408
- className: "h-8 text-xs",
409
- value: t ?? "",
410
- onChange: (t) => $(e.field, t.target.value)
411
- })]
412
- });
413
- case "boolean": return /* @__PURE__ */ (0, A.jsxs)("div", {
414
- className: "space-y-1",
415
- children: [/* @__PURE__ */ (0, A.jsx)(h, {
416
- className: "text-xs text-muted-foreground",
417
- children: n
418
- }), /* @__PURE__ */ (0, A.jsxs)("div", {
419
- className: "flex items-center gap-2 h-8",
420
- children: [/* @__PURE__ */ (0, A.jsx)(ne, {
421
- checked: !!t,
422
- onCheckedChange: (t) => $(e.field, !!t)
423
- }), /* @__PURE__ */ (0, A.jsx)("span", {
424
- className: "text-xs text-muted-foreground",
425
- children: "Yes"
426
- })]
427
- })]
428
- });
429
- default: return /* @__PURE__ */ (0, A.jsxs)("div", {
430
- className: "space-y-1",
431
- children: [/* @__PURE__ */ (0, A.jsx)(h, {
432
- className: "text-xs text-muted-foreground",
433
- children: n
434
- }), /* @__PURE__ */ (0, A.jsx)(m, {
435
- className: "h-8 text-xs",
436
- value: t ?? "",
437
- placeholder: `Filter ${n}`,
438
- onChange: (t) => $(e.field, t.target.value)
439
- })]
440
- });
441
- }
442
- }, [X, $]), dt = a((e, t) => e ? "bg-primary/5 hover:bg-primary/10" : t % 2 == 1 ? "bg-muted/20 hover:bg-accent/30" : "hover:bg-accent/30", []);
443
- return /* @__PURE__ */ (0, A.jsx)(re, {
444
- open: e,
445
- onOpenChange: t,
446
- children: /* @__PURE__ */ (0, A.jsxs)(ie, {
447
- className: "w-[95vw] sm:max-w-3xl lg:max-w-5xl max-h-[85vh] sm:max-h-[80vh] flex flex-col gap-0",
448
- "data-testid": "record-picker-dialog",
449
- children: [
450
- /* @__PURE__ */ (0, A.jsx)(p, { children: /* @__PURE__ */ (0, A.jsxs)(ae, { children: [n, r && /* @__PURE__ */ (0, A.jsx)("span", {
451
- className: "sr-only",
452
- children: " (multiple selection)"
453
- })] }) }),
454
- /* @__PURE__ */ (0, A.jsxs)("div", {
455
- className: "relative rounded-md border bg-muted/30 mb-3",
456
- children: [
457
- /* @__PURE__ */ (0, A.jsx)(ye, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
458
- /* @__PURE__ */ (0, A.jsx)(m, {
459
- placeholder: "Search...",
460
- value: U,
461
- onChange: (e) => Ye(e.target.value),
462
- className: "pl-9 border-0 bg-transparent shadow-none focus-visible:ring-0",
463
- "data-testid": "record-picker-search"
464
- }),
465
- R && /* @__PURE__ */ (0, A.jsx)(ve, {
466
- className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
467
- "data-testid": "record-picker-loading-indicator"
468
- })
469
- ]
470
- }),
471
- Z && Z.length > 0 && /* @__PURE__ */ (0, A.jsx)("div", {
472
- className: "py-2",
473
- children: Ee ? /* @__PURE__ */ (0, A.jsx)("div", {
474
- "data-testid": "record-picker-filter-bar",
475
- children: Ee({
476
- filterColumns: Z,
477
- values: X,
478
- onChange: $,
479
- onClear: ct,
480
- activeCount: lt
481
- })
482
- }) : /* @__PURE__ */ (0, A.jsxs)(A.Fragment, { children: [/* @__PURE__ */ (0, A.jsxs)("div", {
483
- className: "flex items-center gap-2",
484
- "data-testid": "record-picker-filter-bar",
485
- children: [/* @__PURE__ */ (0, A.jsxs)(d, {
486
- type: "button",
487
- variant: lt > 0 ? "secondary" : "outline",
488
- size: "sm",
489
- className: "gap-1.5 shrink-0",
490
- onClick: () => Re((e) => !e),
491
- children: [
492
- /* @__PURE__ */ (0, A.jsx)(be, { className: "size-3.5" }),
493
- "Filters",
494
- lt > 0 && /* @__PURE__ */ (0, A.jsx)("span", {
495
- className: "inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary",
496
- children: lt
497
- })
498
- ]
499
- }), lt > 0 && /* @__PURE__ */ (0, A.jsxs)(d, {
500
- type: "button",
501
- variant: "ghost",
502
- size: "sm",
503
- className: "gap-1 text-xs",
504
- onClick: ct,
505
- children: [/* @__PURE__ */ (0, A.jsx)(i, { className: "size-3" }), "Clear"]
506
- })]
507
- }), Le && /* @__PURE__ */ (0, A.jsx)("div", {
508
- className: "mt-2 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 border rounded-md p-3 bg-muted/30",
509
- "data-testid": "record-picker-filter-panel",
510
- children: Z.map((e) => /* @__PURE__ */ (0, A.jsx)("div", { children: ut(e) }, e.field))
511
- })] })
512
- }),
513
- z && /* @__PURE__ */ (0, A.jsxs)("div", {
514
- className: "flex flex-col items-center gap-2 py-4",
515
- role: "alert",
516
- children: [
517
- /* @__PURE__ */ (0, A.jsx)(_e, { className: "size-5 text-destructive" }),
518
- /* @__PURE__ */ (0, A.jsx)("p", {
519
- className: "text-sm text-destructive",
520
- children: z
521
- }),
522
- /* @__PURE__ */ (0, A.jsx)(d, {
523
- variant: "outline",
524
- size: "sm",
525
- onClick: () => qe(U || void 0, W, Je),
526
- type: "button",
527
- children: "Retry"
528
- })
529
- ]
530
- }),
531
- I ? /* @__PURE__ */ (0, A.jsx)("div", {
532
- className: "flex-1 min-h-0",
533
- "data-testid": "record-picker-grid-slot",
534
- children: I({
535
- columns: Ge,
536
- records: L,
537
- loading: R,
538
- totalCount: V,
539
- currentPage: W,
540
- pageSize: g,
541
- sortField: q,
542
- sortDirection: J,
543
- onSort: Xe,
544
- onPageChange: G,
545
- onRowClick: $e,
546
- isSelected: Qe,
547
- multiple: r,
548
- idField: se,
549
- cellRenderer: P
550
- })
551
- }) : /* @__PURE__ */ (0, A.jsxs)(A.Fragment, { children: [
552
- R && L.length === 0 && !z && /* @__PURE__ */ (0, A.jsx)("div", {
553
- className: "flex-1 overflow-hidden min-h-0 border rounded-md",
554
- role: "status",
555
- "aria-live": "polite",
556
- "data-testid": "record-picker-skeleton",
557
- children: /* @__PURE__ */ (0, A.jsxs)(y, { children: [/* @__PURE__ */ (0, A.jsx)(me, { children: /* @__PURE__ */ (0, A.jsxs)(S, {
558
- className: "bg-muted/40",
559
- children: [r && /* @__PURE__ */ (0, A.jsx)(x, { className: "w-10" }), Ge.map((e) => /* @__PURE__ */ (0, A.jsx)(x, { children: /* @__PURE__ */ (0, A.jsx)(v, { className: "h-4 w-20" }) }, e.field))]
560
- }) }), /* @__PURE__ */ (0, A.jsx)(pe, { children: Array.from({ length: xe }, (e, t) => /* @__PURE__ */ (0, A.jsxs)(S, { children: [r && /* @__PURE__ */ (0, A.jsx)(b, {
561
- className: "w-10",
562
- children: /* @__PURE__ */ (0, A.jsx)(v, { className: "size-4 rounded" })
563
- }), Ge.map((e) => /* @__PURE__ */ (0, A.jsx)(b, { children: /* @__PURE__ */ (0, A.jsx)(v, { className: "h-4 w-full" }) }, e.field))] }, t)) })] })
564
- }),
565
- !R && !z && L.length === 0 && /* @__PURE__ */ (0, A.jsx)("div", {
566
- className: "py-8 text-center",
567
- children: /* @__PURE__ */ (0, A.jsx)("p", {
568
- className: "text-sm text-muted-foreground",
569
- children: "No records found"
570
- })
571
- }),
572
- !z && L.length > 0 && /* @__PURE__ */ (0, A.jsxs)("div", {
573
- className: "relative flex-1 overflow-auto min-h-0 border rounded-md",
574
- tabIndex: 0,
575
- onKeyDown: it,
576
- role: "grid",
577
- "aria-label": "Records",
578
- children: [R && /* @__PURE__ */ (0, A.jsx)("div", {
579
- className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60",
580
- "data-testid": "record-picker-loading-overlay",
581
- children: /* @__PURE__ */ (0, A.jsx)(ve, { className: "size-6 animate-spin text-muted-foreground" })
582
- }), /* @__PURE__ */ (0, A.jsxs)(y, {
583
- style: Object.keys(Be).length > 0 ? { tableLayout: "fixed" } : void 0,
584
- children: [/* @__PURE__ */ (0, A.jsx)(me, {
585
- className: "sticky top-0 z-[5] bg-muted/50 [&_tr]:border-b",
586
- "data-testid": "record-picker-sticky-header",
587
- children: /* @__PURE__ */ (0, A.jsxs)(S, { children: [r && /* @__PURE__ */ (0, A.jsx)(x, { className: "w-10" }), Ge.map((e) => {
588
- let t = Be[e.field];
589
- return /* @__PURE__ */ (0, A.jsxs)(x, {
590
- style: t ? {
591
- width: `${t}px`,
592
- minWidth: `${t}px`
593
- } : e.width ? { width: e.width } : void 0,
594
- className: "cursor-pointer select-none relative group text-xs font-semibold uppercase tracking-wider",
595
- onClick: () => Xe(e.field),
596
- "aria-sort": q === e.field ? J === "asc" ? "ascending" : "descending" : "none",
597
- children: [/* @__PURE__ */ (0, A.jsxs)("span", {
598
- className: "inline-flex items-center",
599
- children: [e.label || Ce(e.field), ot(e.field)]
600
- }), /* @__PURE__ */ (0, A.jsx)("span", {
601
- role: "separator",
602
- "aria-orientation": "vertical",
603
- className: "absolute right-0 top-0 bottom-0 w-1 cursor-col-resize opacity-0 group-hover:opacity-100 bg-border hover:bg-primary/50 transition-opacity",
604
- onMouseDown: (t) => {
605
- let n = t.currentTarget.parentElement?.getBoundingClientRect();
606
- st(t, e.field, n?.width ?? 100);
607
- },
608
- onClick: (e) => e.stopPropagation(),
609
- "data-testid": `resize-handle-${e.field}`
610
- })]
611
- }, e.field);
612
- })] })
613
- }), /* @__PURE__ */ (0, A.jsx)(pe, {
614
- ref: Ie,
615
- children: L.map((e, t) => {
616
- let n = Ze(e), i = Qe(e), ee = t === Y;
617
- return /* @__PURE__ */ (0, A.jsxs)(S, {
618
- "data-row-index": t,
619
- className: he("cursor-pointer transition-colors", dt(i, t), ee && "ring-2 ring-primary ring-inset"),
620
- onClick: () => $e(e),
621
- "data-testid": `record-row-${n}`,
622
- "aria-selected": i,
623
- children: [r && /* @__PURE__ */ (0, A.jsx)(b, {
624
- className: "w-10",
625
- children: i && /* @__PURE__ */ (0, A.jsx)(ge, { className: "size-4 text-primary" })
626
- }), Ge.map((t) => /* @__PURE__ */ (0, A.jsx)(b, {
627
- className: "py-2.5",
628
- children: at(e, t)
629
- }, t.field))]
630
- }, n ?? t);
631
- })
632
- })]
633
- })]
634
- }),
635
- !z && V > 0 && /* @__PURE__ */ (0, A.jsxs)("div", {
636
- className: "flex items-center justify-between text-sm text-muted-foreground border-t pt-3 mt-2 px-1",
637
- "data-testid": "record-picker-pagination",
638
- children: [/* @__PURE__ */ (0, A.jsxs)("span", { children: [
639
- V,
640
- " ",
641
- V === 1 ? "record" : "records",
642
- Q > 1 && ` · Page ${W} of ${Q}`
643
- ] }), Q > 1 && /* @__PURE__ */ (0, A.jsxs)("div", {
644
- className: "flex items-center gap-1.5",
645
- children: [
646
- /* @__PURE__ */ (0, A.jsx)(d, {
647
- variant: "outline",
648
- size: "icon",
649
- className: "size-7",
650
- onClick: tt,
651
- disabled: W <= 1,
652
- type: "button",
653
- "aria-label": "Previous page",
654
- children: /* @__PURE__ */ (0, A.jsx)(D, { className: "size-4" })
655
- }),
656
- /* @__PURE__ */ (0, A.jsx)(m, {
657
- className: "h-7 w-12 text-center text-xs px-1",
658
- placeholder: String(W),
659
- value: Ue,
660
- onChange: (e) => We(e.target.value),
661
- onKeyDown: rt,
662
- "aria-label": "Jump to page",
663
- "data-testid": "record-picker-page-jump"
664
- }),
665
- /* @__PURE__ */ (0, A.jsx)(d, {
666
- variant: "outline",
667
- size: "icon",
668
- className: "size-7",
669
- onClick: nt,
670
- disabled: W >= Q,
671
- type: "button",
672
- "aria-label": "Next page",
673
- children: /* @__PURE__ */ (0, A.jsx)(O, { className: "size-4" })
674
- })
675
- ]
676
- })]
677
- })
678
- ] }),
679
- r && /* @__PURE__ */ (0, A.jsx)(f, { children: /* @__PURE__ */ (0, A.jsxs)("div", {
680
- className: "flex items-center gap-2 w-full justify-between",
681
- children: [/* @__PURE__ */ (0, A.jsxs)("span", {
682
- className: "text-sm text-muted-foreground",
683
- children: [Me.size, " selected"]
684
- }), /* @__PURE__ */ (0, A.jsxs)("div", {
685
- className: "flex gap-2",
686
- children: [/* @__PURE__ */ (0, A.jsx)(d, {
687
- variant: "outline",
688
- type: "button",
689
- onClick: () => t(!1),
690
- children: "Cancel"
691
- }), /* @__PURE__ */ (0, A.jsx)(d, {
692
- type: "button",
693
- onClick: et,
694
- children: "Confirm"
695
- })]
696
- })]
697
- }) })
698
- ]
699
- })
700
- });
701
- }
702
- //#endregion
703
- //#region ../fields/src/widgets/_cell-renderer-bridge.ts
704
- var P;
705
- function F(e) {
706
- P = e;
707
- }
708
- function Ee() {
709
- return P;
710
- }
711
- //#endregion
712
- //#region ../fields/src/widgets/LookupField.tsx
713
- var I = /* @__PURE__ */ e({ LookupField: () => z }), L = 50, De = C;
714
- function R(e, t, n, r) {
715
- let i = e[n] ?? e.id ?? e._id, ee = e[t] ?? e.label ?? e.name ?? String(i), a = r ? e[r] : void 0;
716
- return {
717
- value: i,
718
- label: String(ee),
719
- description: a,
720
- ...e
721
- };
722
- }
723
- function Oe(e) {
724
- return {
725
- text: "text",
726
- number: "number",
727
- currency: "number",
728
- percent: "number",
729
- select: "select",
730
- status: "select",
731
- date: "date",
732
- datetime: "date",
733
- boolean: "boolean"
734
- }[e];
735
- }
736
- function z({ value: e, onChange: t, field: n, readonly: ne, ...re }) {
737
- let [ie, f] = l(!1), [p, ae] = l(""), { t: h } = ee(), [ce, le] = l([]), [ue, de] = l(!1), [fe, v] = l(null), [y, pe] = l(0), b = c(null), [x, me] = l([]), [S, he] = l(-1), C = c(null), w = n || re.schema, T = w?.field, E = T && typeof T == "object" && ("reference_to" in T || "reference" in T || "type" in T) ? T : w, ge = E?.options || [], D = E?.multiple || !1, O = E?.display_field || E?.reference_field || "name", be = E?.description_field, j = E?.id_field || "id", M = E?.reference_to || E?.reference, xe = E?.lookup_columns, Se = E?.lookup_page_size, Ce = E?.lookup_filters, we = s(() => {
738
- if (!xe) return;
739
- let e = [];
740
- for (let t of xe) if (typeof t == "object" && t.type) {
741
- let n = Oe(t.type);
742
- n && e.push({
743
- field: t.field,
744
- label: t.label,
745
- type: n
746
- });
747
- }
748
- return e.length > 0 ? e : void 0;
749
- }, [xe]), Te = te(De)?.dataSource ?? null, P = re.dataSource ?? w?.dataSource ?? E?.dataSource ?? Te, F = P != null && typeof P.find == "function" && !!M, I = re.onCreateNew ?? w?.onCreateNew, [z, B] = l(!1), V = F ? ce : ge, H = s(() => {
750
- if (F || !p) return V;
751
- let e = p.toLowerCase();
752
- return V.filter((t) => t.label.toLowerCase().includes(e) || t.description && t.description.toLowerCase().includes(e));
753
- }, [
754
- F,
755
- V,
756
- p
757
- ]);
758
- o(() => {
759
- he(-1);
760
- }, [H.length]);
761
- let U = a(async (e) => {
762
- if (!(!P || !M)) {
763
- de(!0), v(null);
764
- try {
765
- let t = { $top: L };
766
- e && e.trim() && (t.$search = e.trim());
767
- let n = await P.find(M, t), r = n?.data ?? n ?? [];
768
- le(r.map((e) => R(e, O, j, be))), pe(n?.total ?? r.length);
769
- } catch (e) {
770
- v(e instanceof Error ? e.message : String(e)), le([]);
771
- } finally {
772
- de(!1);
773
- }
774
- }
775
- }, [
776
- P,
777
- M,
778
- O,
779
- j,
780
- be
781
- ]);
782
- o(() => {
783
- ie && F && U(p || void 0), ie || (ae(""), v(null), he(-1));
784
- }, [ie]);
785
- let ke = a((e) => {
786
- ae(e), F && (b.current && clearTimeout(b.current), b.current = setTimeout(() => {
787
- U(e || void 0);
788
- }, 300));
789
- }, [F, U]);
790
- o(() => () => {
791
- b.current && clearTimeout(b.current);
792
- }, []);
793
- let W = a((e) => ge.find((t) => t.value === e) ?? ce.find((t) => t.value === e) ?? x.find((t) => t.value === e), [
794
- ge,
795
- ce,
796
- x
797
- ]), G = D ? (Array.isArray(e) ? e : []).map(W).filter(Boolean) : e ? [W(e)].filter(Boolean) : [], K = a((n) => {
798
- if (D) {
799
- let r = Array.isArray(e) ? e : [];
800
- r.includes(n.value) ? t(r.filter((e) => e !== n.value)) : t([...r, n.value]);
801
- } else t(n.value), f(!1);
802
- }, [
803
- D,
804
- e,
805
- t
806
- ]), q = (n) => {
807
- t(D ? (Array.isArray(e) ? e : []).filter((e) => e !== n) : null);
808
- }, Ae = a((e) => {
809
- me(e.map((e) => R(e, O, j, be)));
810
- }, [
811
- O,
812
- j,
813
- be
814
- ]), J = a((e) => {
815
- e.key === "ArrowDown" ? (e.preventDefault(), he((e) => e < H.length - 1 ? e + 1 : e)) : e.key === "ArrowUp" ? (e.preventDefault(), he((e) => e > 0 ? e - 1 : 0)) : e.key === "Enter" && (e.preventDefault(), S >= 0 && S < H.length && K(H[S]));
816
- }, [
817
- H,
818
- S,
819
- K
820
- ]);
821
- return o(() => {
822
- S >= 0 && C.current && C.current.querySelector(`[data-lookup-index="${S}"]`)?.scrollIntoView({ block: "nearest" });
823
- }, [S]), ne ? G.length ? D ? /* @__PURE__ */ (0, A.jsx)("div", {
824
- className: "flex flex-wrap gap-1",
825
- children: G.map((e, t) => /* @__PURE__ */ (0, A.jsx)(u, {
826
- variant: "outline",
827
- children: e?.[O] || e?.label
828
- }, t))
829
- }) : /* @__PURE__ */ (0, A.jsx)("span", {
830
- className: "text-sm",
831
- children: G[0]?.[O] || G[0]?.label
832
- }) : /* @__PURE__ */ (0, A.jsx)(oe, {}) : /* @__PURE__ */ (0, A.jsxs)("div", {
833
- className: "space-y-2",
834
- children: [
835
- G.length > 0 && /* @__PURE__ */ (0, A.jsx)("div", {
836
- className: "flex flex-wrap gap-1",
837
- children: G.map((e, t) => /* @__PURE__ */ (0, A.jsxs)(u, {
838
- variant: "outline",
839
- className: "gap-1",
840
- children: [e?.[O] || e?.label, /* @__PURE__ */ (0, A.jsx)("button", {
841
- onClick: () => q(e?.value),
842
- className: "ml-1 hover:text-destructive",
843
- type: "button",
844
- "aria-label": `Remove ${e?.[O] || e?.label}`,
845
- children: /* @__PURE__ */ (0, A.jsx)(i, { className: "size-3" })
846
- })]
847
- }, t))
848
- }),
849
- /* @__PURE__ */ (0, A.jsxs)("div", {
850
- className: "flex items-center gap-1.5",
851
- children: [/* @__PURE__ */ (0, A.jsxs)(se, {
852
- open: ie,
853
- onOpenChange: f,
854
- children: [/* @__PURE__ */ (0, A.jsx)(_, {
855
- asChild: !0,
856
- children: /* @__PURE__ */ (0, A.jsxs)(d, {
857
- variant: "outline",
858
- className: "min-w-0 flex-1 justify-start text-left font-normal",
859
- type: "button",
860
- children: [/* @__PURE__ */ (0, A.jsx)(ye, { className: "mr-2 size-4" }), G.length === 0 ? w?.placeholder || h("common.select") : D ? h("table.selected", { count: G.length }) : h("common.select")]
861
- })
862
- }), /* @__PURE__ */ (0, A.jsxs)(g, {
863
- className: "w-[var(--radix-popover-trigger-width)] p-0",
864
- align: "start",
865
- children: [
866
- /* @__PURE__ */ (0, A.jsx)("div", {
867
- className: "p-2",
868
- children: /* @__PURE__ */ (0, A.jsxs)("div", {
869
- className: "relative",
870
- children: [
871
- /* @__PURE__ */ (0, A.jsx)(ye, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground" }),
872
- /* @__PURE__ */ (0, A.jsx)(m, {
873
- placeholder: h("common.search") + "...",
874
- value: p,
875
- onChange: (e) => ke(e.target.value),
876
- onKeyDown: J,
877
- className: "w-full pl-9 h-8 text-sm"
878
- }),
879
- ue && /* @__PURE__ */ (0, A.jsx)(ve, {
880
- className: "absolute right-3 top-1/2 -translate-y-1/2 size-4 animate-spin text-muted-foreground",
881
- "data-testid": "lookup-loading"
882
- })
883
- ]
884
- })
885
- }),
886
- fe && /* @__PURE__ */ (0, A.jsxs)("div", {
887
- className: "flex flex-col items-center gap-2 py-4 px-2",
888
- role: "alert",
889
- children: [
890
- /* @__PURE__ */ (0, A.jsx)(_e, { className: "size-5 text-destructive" }),
891
- /* @__PURE__ */ (0, A.jsx)("p", {
892
- className: "text-sm text-destructive",
893
- children: fe
894
- }),
895
- /* @__PURE__ */ (0, A.jsx)(d, {
896
- variant: "outline",
897
- size: "sm",
898
- onClick: () => U(p || void 0),
899
- type: "button",
900
- children: "Retry"
901
- })
902
- ]
903
- }),
904
- ue && H.length === 0 && !fe && /* @__PURE__ */ (0, A.jsxs)("div", {
905
- className: "flex flex-col items-center gap-2 py-6",
906
- role: "status",
907
- "aria-live": "polite",
908
- children: [/* @__PURE__ */ (0, A.jsx)(ve, { className: "size-6 animate-spin text-muted-foreground" }), /* @__PURE__ */ (0, A.jsx)("p", {
909
- className: "text-sm text-muted-foreground",
910
- children: "Loading…"
911
- })]
912
- }),
913
- !fe && !(ue && H.length === 0) && /* @__PURE__ */ (0, A.jsx)("div", {
914
- ref: C,
915
- className: "max-h-64 overflow-y-auto px-1 pb-1",
916
- role: "listbox",
917
- children: H.length === 0 ? /* @__PURE__ */ (0, A.jsxs)("div", {
918
- className: "py-4 text-center",
919
- children: [/* @__PURE__ */ (0, A.jsx)("p", {
920
- className: "text-sm text-muted-foreground",
921
- children: "No options found"
922
- }), I && /* @__PURE__ */ (0, A.jsxs)(d, {
923
- variant: "ghost",
924
- size: "sm",
925
- className: "mt-2 gap-1",
926
- type: "button",
927
- onClick: () => {
928
- I(p), f(!1);
929
- },
930
- children: [/* @__PURE__ */ (0, A.jsx)(r, { className: "size-4" }), "Create new"]
931
- })]
932
- }) : /* @__PURE__ */ (0, A.jsxs)(A.Fragment, { children: [
933
- H.map((t, n) => {
934
- let r = D ? (Array.isArray(e) ? e : []).includes(t.value) : e === t.value;
935
- return /* @__PURE__ */ (0, A.jsxs)("button", {
936
- "data-lookup-index": n,
937
- role: "option",
938
- "aria-selected": r,
939
- onClick: () => K(t),
940
- className: `w-full text-left px-3 py-2 rounded-md text-sm hover:bg-accent flex items-center justify-between ${n === S ? "bg-accent text-accent-foreground" : r ? "bg-accent/50 text-accent-foreground" : ""}`,
941
- type: "button",
942
- children: [/* @__PURE__ */ (0, A.jsxs)("div", {
943
- className: "min-w-0 flex-1",
944
- children: [/* @__PURE__ */ (0, A.jsx)("span", {
945
- className: "block truncate",
946
- children: t.label
947
- }), t.description && /* @__PURE__ */ (0, A.jsx)("span", {
948
- className: "block truncate text-xs text-muted-foreground",
949
- children: t.description
950
- })]
951
- }), r && /* @__PURE__ */ (0, A.jsx)(u, {
952
- variant: "default",
953
- className: "ml-2 shrink-0",
954
- children: "Selected"
955
- })]
956
- }, t.value);
957
- }),
958
- F && y > H.length && /* @__PURE__ */ (0, A.jsxs)("p", {
959
- className: "text-xs text-muted-foreground text-center py-2",
960
- children: [
961
- "Showing ",
962
- H.length,
963
- " of ",
964
- y,
965
- " results."
966
- ]
967
- }),
968
- F && y > H.length && /* @__PURE__ */ (0, A.jsxs)("button", {
969
- type: "button",
970
- 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",
971
- onClick: () => {
972
- f(!1), B(!0);
973
- },
974
- "data-testid": "show-all-results",
975
- children: [
976
- /* @__PURE__ */ (0, A.jsx)(k, { className: "size-3.5" }),
977
- "Show All Results (",
978
- y,
979
- ")"
980
- ]
981
- }),
982
- I && /* @__PURE__ */ (0, A.jsxs)("button", {
983
- type: "button",
984
- 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",
985
- onClick: () => {
986
- I(p), f(!1);
987
- },
988
- children: [
989
- /* @__PURE__ */ (0, A.jsx)(r, { className: "size-3.5" }),
990
- "Create new",
991
- p ? ` "${p}"` : ""
992
- ]
993
- })
994
- ] })
995
- })
996
- ]
997
- })]
998
- }), F && /* @__PURE__ */ (0, A.jsx)(d, {
999
- variant: "outline",
1000
- size: "icon",
1001
- className: "shrink-0",
1002
- type: "button",
1003
- onClick: () => B(!0),
1004
- "aria-label": "Browse all records",
1005
- title: "Browse all records",
1006
- "data-testid": "browse-all-records",
1007
- children: /* @__PURE__ */ (0, A.jsx)(k, { className: "size-4" })
1008
- })]
1009
- }),
1010
- F && P && M && /* @__PURE__ */ (0, A.jsx)(N, {
1011
- open: z,
1012
- onOpenChange: B,
1013
- title: w?.label || "Select",
1014
- multiple: D,
1015
- dataSource: P,
1016
- objectName: M,
1017
- columns: xe,
1018
- displayField: O,
1019
- idField: j,
1020
- pageSize: Se,
1021
- value: e,
1022
- onSelect: t,
1023
- onSelectRecords: Ae,
1024
- lookupFilters: Ce,
1025
- cellRenderer: Ee(),
1026
- filterColumns: we
1027
- })
1028
- ]
1029
- });
1030
- }
1031
- //#endregion
1032
- export { ge as i, I as n, F as r, z as t };