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