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