@almadar/ui 3.9.1 → 4.0.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/dist/avl/index.cjs +688 -607
- package/dist/avl/index.js +688 -607
- package/dist/components/index.cjs +595 -1210
- package/dist/components/index.js +591 -1192
- package/dist/components/molecules/DataGrid.d.ts +19 -8
- package/dist/components/molecules/DataList.d.ts +22 -7
- package/dist/components/molecules/WizardProgress.d.ts +2 -2
- package/dist/components/organisms/DetailPanel.d.ts +0 -2
- package/dist/components/organisms/Form.d.ts +0 -2
- package/dist/components/organisms/FormSection.d.ts +0 -2
- package/dist/hooks/index.cjs +222 -846
- package/dist/hooks/index.d.ts +0 -4
- package/dist/hooks/index.js +9 -613
- package/dist/providers/index.cjs +604 -762
- package/dist/providers/index.d.ts +0 -2
- package/dist/providers/index.js +605 -758
- package/dist/runtime/EntitySchemaContext.d.ts +7 -3
- package/dist/runtime/index.cjs +1599 -1518
- package/dist/runtime/index.js +830 -749
- package/dist/runtime/ui/SlotsContext.d.ts +57 -17
- package/package.json +1 -1
- package/dist/hooks/useEntityData.d.ts +0 -155
- package/dist/hooks/useEntityMutations.d.ts +0 -80
- package/dist/hooks/useOrbitalMutations.d.ts +0 -95
- package/dist/hooks/useResolvedEntity.d.ts +0 -32
- package/dist/providers/FetchedDataProvider.d.ts +0 -105
|
@@ -6286,13 +6286,13 @@ var init_MapView = __esm({
|
|
|
6286
6286
|
shadowSize: [41, 41]
|
|
6287
6287
|
});
|
|
6288
6288
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
6289
|
-
const { useEffect:
|
|
6289
|
+
const { useEffect: useEffect66, useRef: useRef64, useCallback: useCallback114, useState: useState99 } = React110__namespace.default;
|
|
6290
6290
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
6291
6291
|
const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
6292
6292
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
6293
6293
|
const map = useMap();
|
|
6294
6294
|
const prevRef = useRef64({ centerLat, centerLng, zoom });
|
|
6295
|
-
|
|
6295
|
+
useEffect66(() => {
|
|
6296
6296
|
const prev = prevRef.current;
|
|
6297
6297
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
6298
6298
|
map.setView([centerLat, centerLng], zoom);
|
|
@@ -6303,7 +6303,7 @@ var init_MapView = __esm({
|
|
|
6303
6303
|
}
|
|
6304
6304
|
function MapClickHandler({ onMapClick }) {
|
|
6305
6305
|
const map = useMap();
|
|
6306
|
-
|
|
6306
|
+
useEffect66(() => {
|
|
6307
6307
|
if (!onMapClick) return;
|
|
6308
6308
|
const handler = (e) => {
|
|
6309
6309
|
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
@@ -6330,7 +6330,7 @@ var init_MapView = __esm({
|
|
|
6330
6330
|
showAttribution = true
|
|
6331
6331
|
}) {
|
|
6332
6332
|
const eventBus = useEventBus2();
|
|
6333
|
-
const [clickedPosition, setClickedPosition] =
|
|
6333
|
+
const [clickedPosition, setClickedPosition] = useState99(null);
|
|
6334
6334
|
const handleMapClick = useCallback114((lat, lng) => {
|
|
6335
6335
|
if (showClickedPin) {
|
|
6336
6336
|
setClickedPosition({ lat, lng });
|
|
@@ -17289,7 +17289,290 @@ function formatValue(value, format) {
|
|
|
17289
17289
|
return String(value);
|
|
17290
17290
|
}
|
|
17291
17291
|
}
|
|
17292
|
-
|
|
17292
|
+
function DataGrid({
|
|
17293
|
+
entity,
|
|
17294
|
+
fields: fieldsProp,
|
|
17295
|
+
columns: columnsProp,
|
|
17296
|
+
itemActions,
|
|
17297
|
+
cols,
|
|
17298
|
+
gap = "md",
|
|
17299
|
+
minCardWidth = 280,
|
|
17300
|
+
className,
|
|
17301
|
+
isLoading = false,
|
|
17302
|
+
error = null,
|
|
17303
|
+
imageField,
|
|
17304
|
+
selectable = false,
|
|
17305
|
+
selectionEvent,
|
|
17306
|
+
infiniteScroll,
|
|
17307
|
+
loadMoreEvent,
|
|
17308
|
+
hasMore,
|
|
17309
|
+
children,
|
|
17310
|
+
pageSize = 0
|
|
17311
|
+
}) {
|
|
17312
|
+
const eventBus = useEventBus();
|
|
17313
|
+
const { t } = useTranslate();
|
|
17314
|
+
const [selectedIds, setSelectedIds] = React110.useState(/* @__PURE__ */ new Set());
|
|
17315
|
+
const [visibleCount, setVisibleCount] = React110.useState(pageSize || Infinity);
|
|
17316
|
+
const fields = fieldsProp ?? columnsProp ?? [];
|
|
17317
|
+
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
17318
|
+
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
17319
|
+
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
17320
|
+
const toggleSelection = React110.useCallback((id) => {
|
|
17321
|
+
setSelectedIds((prev) => {
|
|
17322
|
+
const next = new Set(prev);
|
|
17323
|
+
if (next.has(id)) next.delete(id);
|
|
17324
|
+
else next.add(id);
|
|
17325
|
+
if (selectionEvent) {
|
|
17326
|
+
const payload = { selectedIds: Array.from(next) };
|
|
17327
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
17328
|
+
}
|
|
17329
|
+
return next;
|
|
17330
|
+
});
|
|
17331
|
+
}, [selectionEvent, eventBus]);
|
|
17332
|
+
const toggleAll = React110.useCallback(() => {
|
|
17333
|
+
setSelectedIds((prev) => {
|
|
17334
|
+
const allIds2 = data.map((item, i) => item.id || String(i));
|
|
17335
|
+
const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
|
|
17336
|
+
const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
|
|
17337
|
+
if (selectionEvent) {
|
|
17338
|
+
const payload = { selectedIds: Array.from(next) };
|
|
17339
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
17340
|
+
}
|
|
17341
|
+
return next;
|
|
17342
|
+
});
|
|
17343
|
+
}, [data, selectionEvent, eventBus]);
|
|
17344
|
+
const titleField = fields.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fields[0];
|
|
17345
|
+
const badgeFields = fields.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
17346
|
+
const bodyFields = fields.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
17347
|
+
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
17348
|
+
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
17349
|
+
const handleActionClick = (action, itemData) => (e) => {
|
|
17350
|
+
e.stopPropagation();
|
|
17351
|
+
const payload = {
|
|
17352
|
+
id: itemData.id,
|
|
17353
|
+
row: itemData
|
|
17354
|
+
};
|
|
17355
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
17356
|
+
};
|
|
17357
|
+
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
17358
|
+
const colsClass = cols ? {
|
|
17359
|
+
1: "grid-cols-1",
|
|
17360
|
+
2: "sm:grid-cols-2",
|
|
17361
|
+
3: "sm:grid-cols-2 lg:grid-cols-3",
|
|
17362
|
+
4: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
|
|
17363
|
+
5: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",
|
|
17364
|
+
6: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"
|
|
17365
|
+
}[cols] : void 0;
|
|
17366
|
+
if (isLoading) {
|
|
17367
|
+
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "text-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
|
|
17368
|
+
}
|
|
17369
|
+
if (error) {
|
|
17370
|
+
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "text-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", color: "error", children: error.message }) });
|
|
17371
|
+
}
|
|
17372
|
+
if (data.length === 0) {
|
|
17373
|
+
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "text-center py-12", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", color: "secondary", children: t("empty.noItems") || "No items found" }) });
|
|
17374
|
+
}
|
|
17375
|
+
const hasRenderProp = typeof children === "function";
|
|
17376
|
+
const allIds = data.map((item, i) => item.id || String(i));
|
|
17377
|
+
const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
|
|
17378
|
+
const someSelected = selectedIds.size > 0;
|
|
17379
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { gap: "sm", children: [
|
|
17380
|
+
selectable && someSelected && /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
|
|
17381
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17382
|
+
"input",
|
|
17383
|
+
{
|
|
17384
|
+
type: "checkbox",
|
|
17385
|
+
checked: allSelected,
|
|
17386
|
+
onChange: toggleAll,
|
|
17387
|
+
className: "w-4 h-4 accent-primary",
|
|
17388
|
+
"aria-label": "Select all"
|
|
17389
|
+
}
|
|
17390
|
+
),
|
|
17391
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.Typography, { variant: "caption", className: "font-semibold", children: [
|
|
17392
|
+
selectedIds.size,
|
|
17393
|
+
" ",
|
|
17394
|
+
t("common.selected") || "selected"
|
|
17395
|
+
] })
|
|
17396
|
+
] }),
|
|
17397
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17398
|
+
exports.Box,
|
|
17399
|
+
{
|
|
17400
|
+
className: cn("grid", gapStyles6[gap], colsClass, className),
|
|
17401
|
+
style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
|
|
17402
|
+
children: data.map((item, index) => {
|
|
17403
|
+
const itemData = item;
|
|
17404
|
+
const id = itemData.id || String(index);
|
|
17405
|
+
const isSelected = selectedIds.has(id);
|
|
17406
|
+
if (hasRenderProp) {
|
|
17407
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17408
|
+
exports.Box,
|
|
17409
|
+
{
|
|
17410
|
+
"data-entity-row": true,
|
|
17411
|
+
"data-entity-id": id,
|
|
17412
|
+
className: cn(
|
|
17413
|
+
"bg-card rounded-lg",
|
|
17414
|
+
"border border-border",
|
|
17415
|
+
"shadow-sm hover:shadow-lg",
|
|
17416
|
+
"hover:border-primary transition-all",
|
|
17417
|
+
"p-4",
|
|
17418
|
+
isSelected && "ring-2 ring-primary border-primary"
|
|
17419
|
+
),
|
|
17420
|
+
children: children(itemData, index)
|
|
17421
|
+
},
|
|
17422
|
+
id
|
|
17423
|
+
);
|
|
17424
|
+
}
|
|
17425
|
+
const titleValue = getNestedValue(itemData, titleField?.name ?? "");
|
|
17426
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17427
|
+
exports.Box,
|
|
17428
|
+
{
|
|
17429
|
+
"data-entity-row": true,
|
|
17430
|
+
"data-entity-id": id,
|
|
17431
|
+
className: cn(
|
|
17432
|
+
"bg-card rounded-lg",
|
|
17433
|
+
"border border-border",
|
|
17434
|
+
"shadow-sm hover:shadow-lg",
|
|
17435
|
+
"hover:border-primary transition-all",
|
|
17436
|
+
"flex flex-col",
|
|
17437
|
+
isSelected && "ring-2 ring-primary border-primary"
|
|
17438
|
+
),
|
|
17439
|
+
children: [
|
|
17440
|
+
imageField && (() => {
|
|
17441
|
+
const imgUrl = getNestedValue(itemData, imageField);
|
|
17442
|
+
if (!imgUrl || typeof imgUrl !== "string") return null;
|
|
17443
|
+
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17444
|
+
"img",
|
|
17445
|
+
{
|
|
17446
|
+
src: imgUrl,
|
|
17447
|
+
alt: titleValue !== void 0 ? String(titleValue) : "",
|
|
17448
|
+
className: "w-full h-full object-cover",
|
|
17449
|
+
loading: "lazy"
|
|
17450
|
+
}
|
|
17451
|
+
) });
|
|
17452
|
+
})(),
|
|
17453
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", className: "justify-between items-start", children: [
|
|
17454
|
+
selectable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17455
|
+
"input",
|
|
17456
|
+
{
|
|
17457
|
+
type: "checkbox",
|
|
17458
|
+
checked: isSelected,
|
|
17459
|
+
onChange: () => toggleSelection(id),
|
|
17460
|
+
onClick: (e) => e.stopPropagation(),
|
|
17461
|
+
className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
|
|
17462
|
+
"aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
|
|
17463
|
+
}
|
|
17464
|
+
),
|
|
17465
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
|
|
17466
|
+
titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center", children: [
|
|
17467
|
+
titleField?.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
|
|
17468
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17469
|
+
exports.Typography,
|
|
17470
|
+
{
|
|
17471
|
+
variant: titleField?.variant === "h3" ? "h3" : "h4",
|
|
17472
|
+
className: "font-semibold truncate",
|
|
17473
|
+
children: String(titleValue)
|
|
17474
|
+
}
|
|
17475
|
+
)
|
|
17476
|
+
] }),
|
|
17477
|
+
badgeFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
|
|
17478
|
+
const val = getNestedValue(itemData, field.name);
|
|
17479
|
+
if (val === void 0 || val === null) return null;
|
|
17480
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center", children: [
|
|
17481
|
+
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs" }),
|
|
17482
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: statusVariant2(String(val)), children: String(val) })
|
|
17483
|
+
] }, field.name);
|
|
17484
|
+
}) })
|
|
17485
|
+
] }),
|
|
17486
|
+
dangerActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17487
|
+
exports.Button,
|
|
17488
|
+
{
|
|
17489
|
+
variant: "ghost",
|
|
17490
|
+
size: "sm",
|
|
17491
|
+
onClick: handleActionClick(action, itemData),
|
|
17492
|
+
"data-testid": `action-${action.event}`,
|
|
17493
|
+
className: "text-error hover:bg-error/10 px-2",
|
|
17494
|
+
children: [
|
|
17495
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: action.icon, size: "xs" }),
|
|
17496
|
+
action.label
|
|
17497
|
+
]
|
|
17498
|
+
},
|
|
17499
|
+
idx
|
|
17500
|
+
)) })
|
|
17501
|
+
] }) }),
|
|
17502
|
+
bodyFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(exports.VStack, { gap: "xs", children: bodyFields.map((field) => {
|
|
17503
|
+
const value = getNestedValue(itemData, field.name);
|
|
17504
|
+
if (value === void 0 || value === null || value === "") return null;
|
|
17505
|
+
if (field.format === "boolean") {
|
|
17506
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", className: "justify-between items-center", children: [
|
|
17507
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center", children: [
|
|
17508
|
+
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
|
|
17509
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
|
|
17510
|
+
] }),
|
|
17511
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
|
|
17512
|
+
] }, field.name);
|
|
17513
|
+
}
|
|
17514
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", className: "justify-between items-center", children: [
|
|
17515
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center", children: [
|
|
17516
|
+
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
|
|
17517
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
|
|
17518
|
+
] }),
|
|
17519
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17520
|
+
exports.Typography,
|
|
17521
|
+
{
|
|
17522
|
+
variant: field.variant === "caption" ? "caption" : "small",
|
|
17523
|
+
className: "text-right truncate max-w-[60%]",
|
|
17524
|
+
children: formatValue(value, field.format)
|
|
17525
|
+
}
|
|
17526
|
+
)
|
|
17527
|
+
] }, field.name);
|
|
17528
|
+
}) }) }),
|
|
17529
|
+
primaryActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "sm", className: "justify-end", children: primaryActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17530
|
+
exports.Button,
|
|
17531
|
+
{
|
|
17532
|
+
variant: action.variant === "primary" ? "primary" : "ghost",
|
|
17533
|
+
size: "sm",
|
|
17534
|
+
onClick: handleActionClick(action, itemData),
|
|
17535
|
+
"data-testid": `action-${action.event}`,
|
|
17536
|
+
children: [
|
|
17537
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
17538
|
+
action.label
|
|
17539
|
+
]
|
|
17540
|
+
},
|
|
17541
|
+
idx
|
|
17542
|
+
)) }) })
|
|
17543
|
+
]
|
|
17544
|
+
},
|
|
17545
|
+
id
|
|
17546
|
+
);
|
|
17547
|
+
})
|
|
17548
|
+
}
|
|
17549
|
+
),
|
|
17550
|
+
hasMoreLocal && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17551
|
+
exports.Button,
|
|
17552
|
+
{
|
|
17553
|
+
variant: "ghost",
|
|
17554
|
+
size: "sm",
|
|
17555
|
+
onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
|
|
17556
|
+
children: [
|
|
17557
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
|
|
17558
|
+
t("common.showMore"),
|
|
17559
|
+
" (",
|
|
17560
|
+
allData.length - visibleCount,
|
|
17561
|
+
" remaining)"
|
|
17562
|
+
]
|
|
17563
|
+
}
|
|
17564
|
+
) }),
|
|
17565
|
+
infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17566
|
+
exports.InfiniteScrollSentinel,
|
|
17567
|
+
{
|
|
17568
|
+
loadMoreEvent,
|
|
17569
|
+
isLoading,
|
|
17570
|
+
hasMore
|
|
17571
|
+
}
|
|
17572
|
+
)
|
|
17573
|
+
] });
|
|
17574
|
+
}
|
|
17575
|
+
var gapStyles6;
|
|
17293
17576
|
var init_DataGrid = __esm({
|
|
17294
17577
|
"components/molecules/DataGrid.tsx"() {
|
|
17295
17578
|
"use client";
|
|
@@ -17311,290 +17594,7 @@ var init_DataGrid = __esm({
|
|
|
17311
17594
|
lg: "gap-6",
|
|
17312
17595
|
xl: "gap-8"
|
|
17313
17596
|
};
|
|
17314
|
-
|
|
17315
|
-
entity,
|
|
17316
|
-
fields: fieldsProp,
|
|
17317
|
-
columns: columnsProp,
|
|
17318
|
-
itemActions,
|
|
17319
|
-
cols,
|
|
17320
|
-
gap = "md",
|
|
17321
|
-
minCardWidth = 280,
|
|
17322
|
-
className,
|
|
17323
|
-
isLoading = false,
|
|
17324
|
-
error = null,
|
|
17325
|
-
imageField,
|
|
17326
|
-
selectable = false,
|
|
17327
|
-
selectionEvent,
|
|
17328
|
-
infiniteScroll,
|
|
17329
|
-
loadMoreEvent,
|
|
17330
|
-
hasMore,
|
|
17331
|
-
children,
|
|
17332
|
-
pageSize = 0
|
|
17333
|
-
}) => {
|
|
17334
|
-
const eventBus = useEventBus();
|
|
17335
|
-
const { t } = useTranslate();
|
|
17336
|
-
const [selectedIds, setSelectedIds] = React110.useState(/* @__PURE__ */ new Set());
|
|
17337
|
-
const [visibleCount, setVisibleCount] = React110.useState(pageSize || Infinity);
|
|
17338
|
-
const fields = fieldsProp ?? columnsProp ?? [];
|
|
17339
|
-
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
17340
|
-
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
17341
|
-
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
17342
|
-
const toggleSelection = React110.useCallback((id) => {
|
|
17343
|
-
setSelectedIds((prev) => {
|
|
17344
|
-
const next = new Set(prev);
|
|
17345
|
-
if (next.has(id)) next.delete(id);
|
|
17346
|
-
else next.add(id);
|
|
17347
|
-
if (selectionEvent) {
|
|
17348
|
-
const payload = { selectedIds: Array.from(next) };
|
|
17349
|
-
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
17350
|
-
}
|
|
17351
|
-
return next;
|
|
17352
|
-
});
|
|
17353
|
-
}, [selectionEvent, eventBus]);
|
|
17354
|
-
const toggleAll = React110.useCallback(() => {
|
|
17355
|
-
setSelectedIds((prev) => {
|
|
17356
|
-
const allIds2 = data.map((item, i) => item.id || String(i));
|
|
17357
|
-
const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
|
|
17358
|
-
const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
|
|
17359
|
-
if (selectionEvent) {
|
|
17360
|
-
const payload = { selectedIds: Array.from(next) };
|
|
17361
|
-
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
17362
|
-
}
|
|
17363
|
-
return next;
|
|
17364
|
-
});
|
|
17365
|
-
}, [data, selectionEvent, eventBus]);
|
|
17366
|
-
const titleField = fields.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fields[0];
|
|
17367
|
-
const badgeFields = fields.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
17368
|
-
const bodyFields = fields.filter((f3) => f3 !== titleField && !badgeFields.includes(f3));
|
|
17369
|
-
const primaryActions = itemActions?.filter((a) => a.variant !== "danger") ?? [];
|
|
17370
|
-
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
17371
|
-
const handleActionClick = (action, itemData) => (e) => {
|
|
17372
|
-
e.stopPropagation();
|
|
17373
|
-
const payload = {
|
|
17374
|
-
id: itemData.id,
|
|
17375
|
-
row: itemData
|
|
17376
|
-
};
|
|
17377
|
-
eventBus.emit(`UI:${action.event}`, payload);
|
|
17378
|
-
};
|
|
17379
|
-
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
17380
|
-
const colsClass = cols ? {
|
|
17381
|
-
1: "grid-cols-1",
|
|
17382
|
-
2: "sm:grid-cols-2",
|
|
17383
|
-
3: "sm:grid-cols-2 lg:grid-cols-3",
|
|
17384
|
-
4: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
|
|
17385
|
-
5: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5",
|
|
17386
|
-
6: "sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"
|
|
17387
|
-
}[cols] : void 0;
|
|
17388
|
-
if (isLoading) {
|
|
17389
|
-
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "text-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
|
|
17390
|
-
}
|
|
17391
|
-
if (error) {
|
|
17392
|
-
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "text-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", color: "error", children: error.message }) });
|
|
17393
|
-
}
|
|
17394
|
-
if (data.length === 0) {
|
|
17395
|
-
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "text-center py-12", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", color: "secondary", children: t("empty.noItems") || "No items found" }) });
|
|
17396
|
-
}
|
|
17397
|
-
const hasRenderProp = typeof children === "function";
|
|
17398
|
-
const allIds = data.map((item, i) => item.id || String(i));
|
|
17399
|
-
const allSelected = allIds.length > 0 && allIds.every((id) => selectedIds.has(id));
|
|
17400
|
-
const someSelected = selectedIds.size > 0;
|
|
17401
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { gap: "sm", children: [
|
|
17402
|
-
selectable && someSelected && /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", className: "items-center px-2 py-2 bg-muted rounded-sm", children: [
|
|
17403
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17404
|
-
"input",
|
|
17405
|
-
{
|
|
17406
|
-
type: "checkbox",
|
|
17407
|
-
checked: allSelected,
|
|
17408
|
-
onChange: toggleAll,
|
|
17409
|
-
className: "w-4 h-4 accent-primary",
|
|
17410
|
-
"aria-label": "Select all"
|
|
17411
|
-
}
|
|
17412
|
-
),
|
|
17413
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.Typography, { variant: "caption", className: "font-semibold", children: [
|
|
17414
|
-
selectedIds.size,
|
|
17415
|
-
" ",
|
|
17416
|
-
t("common.selected") || "selected"
|
|
17417
|
-
] })
|
|
17418
|
-
] }),
|
|
17419
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17420
|
-
exports.Box,
|
|
17421
|
-
{
|
|
17422
|
-
className: cn("grid", gapStyles6[gap], colsClass, className),
|
|
17423
|
-
style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
|
|
17424
|
-
children: data.map((item, index) => {
|
|
17425
|
-
const itemData = item;
|
|
17426
|
-
const id = itemData.id || String(index);
|
|
17427
|
-
const isSelected = selectedIds.has(id);
|
|
17428
|
-
if (hasRenderProp) {
|
|
17429
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17430
|
-
exports.Box,
|
|
17431
|
-
{
|
|
17432
|
-
"data-entity-row": true,
|
|
17433
|
-
"data-entity-id": id,
|
|
17434
|
-
className: cn(
|
|
17435
|
-
"bg-card rounded-lg",
|
|
17436
|
-
"border border-border",
|
|
17437
|
-
"shadow-sm hover:shadow-lg",
|
|
17438
|
-
"hover:border-primary transition-all",
|
|
17439
|
-
"p-4",
|
|
17440
|
-
isSelected && "ring-2 ring-primary border-primary"
|
|
17441
|
-
),
|
|
17442
|
-
children: children(itemData, index)
|
|
17443
|
-
},
|
|
17444
|
-
id
|
|
17445
|
-
);
|
|
17446
|
-
}
|
|
17447
|
-
const titleValue = getNestedValue(itemData, titleField?.name ?? "");
|
|
17448
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17449
|
-
exports.Box,
|
|
17450
|
-
{
|
|
17451
|
-
"data-entity-row": true,
|
|
17452
|
-
"data-entity-id": id,
|
|
17453
|
-
className: cn(
|
|
17454
|
-
"bg-card rounded-lg",
|
|
17455
|
-
"border border-border",
|
|
17456
|
-
"shadow-sm hover:shadow-lg",
|
|
17457
|
-
"hover:border-primary transition-all",
|
|
17458
|
-
"flex flex-col",
|
|
17459
|
-
isSelected && "ring-2 ring-primary border-primary"
|
|
17460
|
-
),
|
|
17461
|
-
children: [
|
|
17462
|
-
imageField && (() => {
|
|
17463
|
-
const imgUrl = getNestedValue(itemData, imageField);
|
|
17464
|
-
if (!imgUrl || typeof imgUrl !== "string") return null;
|
|
17465
|
-
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "w-full aspect-video overflow-hidden rounded-t-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17466
|
-
"img",
|
|
17467
|
-
{
|
|
17468
|
-
src: imgUrl,
|
|
17469
|
-
alt: titleValue !== void 0 ? String(titleValue) : "",
|
|
17470
|
-
className: "w-full h-full object-cover",
|
|
17471
|
-
loading: "lazy"
|
|
17472
|
-
}
|
|
17473
|
-
) });
|
|
17474
|
-
})(),
|
|
17475
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "p-4 pb-0", children: /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", className: "justify-between items-start", children: [
|
|
17476
|
-
selectable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17477
|
-
"input",
|
|
17478
|
-
{
|
|
17479
|
-
type: "checkbox",
|
|
17480
|
-
checked: isSelected,
|
|
17481
|
-
onChange: () => toggleSelection(id),
|
|
17482
|
-
onClick: (e) => e.stopPropagation(),
|
|
17483
|
-
className: "w-4 h-4 mt-1 flex-shrink-0 accent-primary",
|
|
17484
|
-
"aria-label": `Select ${titleValue !== void 0 ? String(titleValue) : "item"}`
|
|
17485
|
-
}
|
|
17486
|
-
),
|
|
17487
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.VStack, { gap: "xs", className: "flex-1 min-w-0", children: [
|
|
17488
|
-
titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center", children: [
|
|
17489
|
-
titleField?.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: titleField.icon, size: "sm", className: "text-primary flex-shrink-0" }),
|
|
17490
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17491
|
-
exports.Typography,
|
|
17492
|
-
{
|
|
17493
|
-
variant: titleField?.variant === "h3" ? "h3" : "h4",
|
|
17494
|
-
className: "font-semibold truncate",
|
|
17495
|
-
children: String(titleValue)
|
|
17496
|
-
}
|
|
17497
|
-
)
|
|
17498
|
-
] }),
|
|
17499
|
-
badgeFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "xs", className: "flex-wrap", children: badgeFields.map((field) => {
|
|
17500
|
-
const val = getNestedValue(itemData, field.name);
|
|
17501
|
-
if (val === void 0 || val === null) return null;
|
|
17502
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center", children: [
|
|
17503
|
-
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs" }),
|
|
17504
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: statusVariant2(String(val)), children: String(val) })
|
|
17505
|
-
] }, field.name);
|
|
17506
|
-
}) })
|
|
17507
|
-
] }),
|
|
17508
|
-
dangerActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "xs", className: "flex-shrink-0", children: dangerActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17509
|
-
exports.Button,
|
|
17510
|
-
{
|
|
17511
|
-
variant: "ghost",
|
|
17512
|
-
size: "sm",
|
|
17513
|
-
onClick: handleActionClick(action, itemData),
|
|
17514
|
-
"data-testid": `action-${action.event}`,
|
|
17515
|
-
className: "text-error hover:bg-error/10 px-2",
|
|
17516
|
-
children: [
|
|
17517
|
-
action.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: action.icon, size: "xs" }),
|
|
17518
|
-
action.label
|
|
17519
|
-
]
|
|
17520
|
-
},
|
|
17521
|
-
idx
|
|
17522
|
-
)) })
|
|
17523
|
-
] }) }),
|
|
17524
|
-
bodyFields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "px-4 py-3 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(exports.VStack, { gap: "xs", children: bodyFields.map((field) => {
|
|
17525
|
-
const value = getNestedValue(itemData, field.name);
|
|
17526
|
-
if (value === void 0 || value === null || value === "") return null;
|
|
17527
|
-
if (field.format === "boolean") {
|
|
17528
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", className: "justify-between items-center", children: [
|
|
17529
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center", children: [
|
|
17530
|
-
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
|
|
17531
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
|
|
17532
|
-
] }),
|
|
17533
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: value ? "success" : "neutral", children: value ? t("common.yes") || "Yes" : t("common.no") || "No" })
|
|
17534
|
-
] }, field.name);
|
|
17535
|
-
}
|
|
17536
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", className: "justify-between items-center", children: [
|
|
17537
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center", children: [
|
|
17538
|
-
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
|
|
17539
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel2(field.name) })
|
|
17540
|
-
] }),
|
|
17541
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17542
|
-
exports.Typography,
|
|
17543
|
-
{
|
|
17544
|
-
variant: field.variant === "caption" ? "caption" : "small",
|
|
17545
|
-
className: "text-right truncate max-w-[60%]",
|
|
17546
|
-
children: formatValue(value, field.format)
|
|
17547
|
-
}
|
|
17548
|
-
)
|
|
17549
|
-
] }, field.name);
|
|
17550
|
-
}) }) }),
|
|
17551
|
-
primaryActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "sm", className: "justify-end", children: primaryActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17552
|
-
exports.Button,
|
|
17553
|
-
{
|
|
17554
|
-
variant: action.variant === "primary" ? "primary" : "ghost",
|
|
17555
|
-
size: "sm",
|
|
17556
|
-
onClick: handleActionClick(action, itemData),
|
|
17557
|
-
"data-testid": `action-${action.event}`,
|
|
17558
|
-
children: [
|
|
17559
|
-
action.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
17560
|
-
action.label
|
|
17561
|
-
]
|
|
17562
|
-
},
|
|
17563
|
-
idx
|
|
17564
|
-
)) }) })
|
|
17565
|
-
]
|
|
17566
|
-
},
|
|
17567
|
-
id
|
|
17568
|
-
);
|
|
17569
|
-
})
|
|
17570
|
-
}
|
|
17571
|
-
),
|
|
17572
|
-
hasMoreLocal && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17573
|
-
exports.Button,
|
|
17574
|
-
{
|
|
17575
|
-
variant: "ghost",
|
|
17576
|
-
size: "sm",
|
|
17577
|
-
onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
|
|
17578
|
-
children: [
|
|
17579
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
|
|
17580
|
-
t("common.showMore"),
|
|
17581
|
-
" (",
|
|
17582
|
-
allData.length - visibleCount,
|
|
17583
|
-
" remaining)"
|
|
17584
|
-
]
|
|
17585
|
-
}
|
|
17586
|
-
) }),
|
|
17587
|
-
infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17588
|
-
exports.InfiniteScrollSentinel,
|
|
17589
|
-
{
|
|
17590
|
-
loadMoreEvent,
|
|
17591
|
-
isLoading,
|
|
17592
|
-
hasMore
|
|
17593
|
-
}
|
|
17594
|
-
)
|
|
17595
|
-
] });
|
|
17596
|
-
};
|
|
17597
|
-
exports.DataGrid.displayName = "DataGrid";
|
|
17597
|
+
DataGrid.displayName = "DataGrid";
|
|
17598
17598
|
}
|
|
17599
17599
|
});
|
|
17600
17600
|
function fieldLabel3(key) {
|
|
@@ -17641,319 +17641,318 @@ function groupData(items, field) {
|
|
|
17641
17641
|
}
|
|
17642
17642
|
return Array.from(groups.entries()).map(([label, groupItems]) => ({ label, items: groupItems }));
|
|
17643
17643
|
}
|
|
17644
|
-
|
|
17645
|
-
|
|
17646
|
-
|
|
17647
|
-
|
|
17648
|
-
|
|
17649
|
-
|
|
17650
|
-
|
|
17651
|
-
|
|
17652
|
-
|
|
17653
|
-
|
|
17654
|
-
|
|
17655
|
-
|
|
17656
|
-
|
|
17657
|
-
|
|
17658
|
-
|
|
17659
|
-
|
|
17660
|
-
|
|
17661
|
-
|
|
17662
|
-
|
|
17663
|
-
|
|
17664
|
-
|
|
17665
|
-
|
|
17666
|
-
|
|
17667
|
-
|
|
17668
|
-
|
|
17669
|
-
|
|
17670
|
-
|
|
17671
|
-
|
|
17672
|
-
|
|
17673
|
-
|
|
17674
|
-
|
|
17675
|
-
|
|
17676
|
-
|
|
17677
|
-
|
|
17678
|
-
|
|
17679
|
-
|
|
17680
|
-
|
|
17681
|
-
|
|
17682
|
-
|
|
17683
|
-
|
|
17684
|
-
|
|
17685
|
-
|
|
17686
|
-
|
|
17687
|
-
|
|
17688
|
-
|
|
17689
|
-
|
|
17690
|
-
|
|
17691
|
-
|
|
17692
|
-
|
|
17693
|
-
|
|
17694
|
-
|
|
17695
|
-
|
|
17696
|
-
|
|
17697
|
-
|
|
17698
|
-
|
|
17699
|
-
|
|
17700
|
-
|
|
17701
|
-
|
|
17702
|
-
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
|
|
17706
|
-
|
|
17707
|
-
|
|
17708
|
-
|
|
17709
|
-
|
|
17710
|
-
|
|
17711
|
-
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
|
|
17715
|
-
|
|
17716
|
-
|
|
17717
|
-
|
|
17718
|
-
|
|
17719
|
-
|
|
17720
|
-
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
|
|
17724
|
-
|
|
17725
|
-
|
|
17726
|
-
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17730
|
-
|
|
17731
|
-
|
|
17732
|
-
|
|
17733
|
-
return /* @__PURE__ */ jsxRuntime.jsx(exports.VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React110__namespace.default.Fragment, { children: [
|
|
17734
|
-
group.label && /* @__PURE__ */ jsxRuntime.jsx(exports.Divider, { label: group.label, className: "my-2" }),
|
|
17735
|
-
group.items.map((itemData, index) => {
|
|
17736
|
-
const id = itemData.id || `${gi}-${index}`;
|
|
17737
|
-
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
17738
|
-
const isSent = Boolean(currentUser && sender === currentUser);
|
|
17739
|
-
const content = getNestedValue(itemData, contentField);
|
|
17740
|
-
const timestampField = fields.find((f3) => f3.format === "date");
|
|
17741
|
-
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
17742
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17743
|
-
exports.Box,
|
|
17744
|
-
{
|
|
17745
|
-
className: cn(
|
|
17746
|
-
"flex px-4",
|
|
17747
|
-
isSent ? "justify-end" : "justify-start"
|
|
17748
|
-
),
|
|
17749
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17750
|
-
exports.Box,
|
|
17751
|
-
{
|
|
17752
|
-
className: cn(
|
|
17753
|
-
"max-w-[75%] px-4 py-2",
|
|
17754
|
-
isSent ? "bg-primary text-primary-foreground rounded-2xl rounded-br-sm" : "bg-muted text-foreground rounded-2xl rounded-bl-sm"
|
|
17755
|
-
),
|
|
17756
|
-
children: [
|
|
17757
|
-
!isSent && senderField && /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "font-semibold mb-0.5", children: sender }),
|
|
17758
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", children: content !== void 0 && content !== null ? String(content) : "" }),
|
|
17759
|
-
timestamp != null ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
17760
|
-
exports.Typography,
|
|
17761
|
-
{
|
|
17762
|
-
variant: "caption",
|
|
17763
|
-
className: cn(
|
|
17764
|
-
"mt-1 text-[0.65rem]",
|
|
17765
|
-
isSent ? "opacity-70" : "text-muted-foreground"
|
|
17766
|
-
),
|
|
17767
|
-
children: formatDate3(timestamp)
|
|
17768
|
-
}
|
|
17769
|
-
) : null
|
|
17770
|
-
]
|
|
17771
|
-
}
|
|
17772
|
-
)
|
|
17773
|
-
},
|
|
17774
|
-
id
|
|
17775
|
-
);
|
|
17776
|
-
})
|
|
17777
|
-
] }, gi)) });
|
|
17778
|
-
}
|
|
17779
|
-
const hasRenderProp = typeof children === "function";
|
|
17780
|
-
const items = data.map((item) => item);
|
|
17781
|
-
const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
|
|
17782
|
-
const renderItem = (itemData, index, isLast) => {
|
|
17783
|
-
if (hasRenderProp) {
|
|
17784
|
-
const id2 = itemData.id || String(index);
|
|
17785
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { "data-entity-row": true, "data-entity-id": id2, children: [
|
|
17786
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
17644
|
+
function DataList({
|
|
17645
|
+
entity,
|
|
17646
|
+
fields: fieldsProp,
|
|
17647
|
+
columns: columnsProp,
|
|
17648
|
+
itemActions,
|
|
17649
|
+
gap = "none",
|
|
17650
|
+
variant = "default",
|
|
17651
|
+
groupBy,
|
|
17652
|
+
senderField,
|
|
17653
|
+
currentUser,
|
|
17654
|
+
className,
|
|
17655
|
+
isLoading = false,
|
|
17656
|
+
error = null,
|
|
17657
|
+
// Gesture props: reorderable, swipeLeftEvent, swipeRightEvent, longPressEvent
|
|
17658
|
+
// are consumed by the compiler to wrap items in SwipeableRow/SortableList.
|
|
17659
|
+
// DataList destructures them here to prevent DOM passthrough.
|
|
17660
|
+
reorderable: _reorderable,
|
|
17661
|
+
reorderEvent: _reorderEvent,
|
|
17662
|
+
swipeLeftEvent: _swipeLeftEvent,
|
|
17663
|
+
swipeLeftActions: _swipeLeftActions,
|
|
17664
|
+
swipeRightEvent: _swipeRightEvent,
|
|
17665
|
+
swipeRightActions: _swipeRightActions,
|
|
17666
|
+
longPressEvent: _longPressEvent,
|
|
17667
|
+
infiniteScroll,
|
|
17668
|
+
loadMoreEvent,
|
|
17669
|
+
hasMore,
|
|
17670
|
+
children,
|
|
17671
|
+
pageSize = 5
|
|
17672
|
+
}) {
|
|
17673
|
+
const eventBus = useEventBus();
|
|
17674
|
+
const { t } = useTranslate();
|
|
17675
|
+
const [visibleCount, setVisibleCount] = React110__namespace.default.useState(pageSize || Infinity);
|
|
17676
|
+
const fields = fieldsProp ?? columnsProp ?? [];
|
|
17677
|
+
const allData = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
17678
|
+
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
17679
|
+
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
17680
|
+
const titleField = fields.find((f3) => f3.variant === "h3" || f3.variant === "h4") ?? fields[0];
|
|
17681
|
+
const badgeFields = fields.filter((f3) => f3.variant === "badge" && f3 !== titleField);
|
|
17682
|
+
const progressFields = fields.filter((f3) => f3.variant === "progress");
|
|
17683
|
+
const bodyFields = fields.filter(
|
|
17684
|
+
(f3) => f3 !== titleField && !badgeFields.includes(f3) && !progressFields.includes(f3)
|
|
17685
|
+
);
|
|
17686
|
+
const handleActionClick = (action, itemData) => (e) => {
|
|
17687
|
+
e.stopPropagation();
|
|
17688
|
+
const payload = {
|
|
17689
|
+
id: itemData.id,
|
|
17690
|
+
row: itemData
|
|
17691
|
+
};
|
|
17692
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
17693
|
+
};
|
|
17694
|
+
if (isLoading) {
|
|
17695
|
+
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "text-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
|
|
17696
|
+
}
|
|
17697
|
+
if (error) {
|
|
17698
|
+
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "text-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", color: "error", children: error.message }) });
|
|
17699
|
+
}
|
|
17700
|
+
if (data.length === 0) {
|
|
17701
|
+
return /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "text-center py-12", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", color: "secondary", children: t("empty.noItems") || "No items found" }) });
|
|
17702
|
+
}
|
|
17703
|
+
const gapClass = {
|
|
17704
|
+
none: "",
|
|
17705
|
+
sm: "gap-1",
|
|
17706
|
+
md: "gap-2",
|
|
17707
|
+
lg: "gap-4"
|
|
17708
|
+
}[gap];
|
|
17709
|
+
const isCard = variant === "card";
|
|
17710
|
+
const isCompact = variant === "compact";
|
|
17711
|
+
const isMessage = variant === "message";
|
|
17712
|
+
if (isMessage) {
|
|
17713
|
+
const items2 = data.map((item) => item);
|
|
17714
|
+
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
17715
|
+
const contentField = titleField?.name ?? fields[0]?.name ?? "";
|
|
17716
|
+
return /* @__PURE__ */ jsxRuntime.jsx(exports.VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React110__namespace.default.Fragment, { children: [
|
|
17717
|
+
group.label && /* @__PURE__ */ jsxRuntime.jsx(exports.Divider, { label: group.label, className: "my-2" }),
|
|
17718
|
+
group.items.map((itemData, index) => {
|
|
17719
|
+
const id = itemData.id || `${gi}-${index}`;
|
|
17720
|
+
const sender = senderField ? String(getNestedValue(itemData, senderField) ?? "") : "";
|
|
17721
|
+
const isSent = Boolean(currentUser && sender === currentUser);
|
|
17722
|
+
const content = getNestedValue(itemData, contentField);
|
|
17723
|
+
const timestampField = fields.find((f3) => f3.format === "date");
|
|
17724
|
+
const timestamp = timestampField ? getNestedValue(itemData, timestampField.name) : null;
|
|
17725
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17726
|
+
exports.Box,
|
|
17727
|
+
{
|
|
17728
|
+
className: cn(
|
|
17729
|
+
"flex px-4",
|
|
17730
|
+
isSent ? "justify-end" : "justify-start"
|
|
17731
|
+
),
|
|
17732
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17787
17733
|
exports.Box,
|
|
17788
17734
|
{
|
|
17789
17735
|
className: cn(
|
|
17790
|
-
"
|
|
17791
|
-
|
|
17792
|
-
"hover:bg-muted/80",
|
|
17793
|
-
!isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
|
|
17736
|
+
"max-w-[75%] px-4 py-2",
|
|
17737
|
+
isSent ? "bg-primary text-primary-foreground rounded-2xl rounded-br-sm" : "bg-muted text-foreground rounded-2xl rounded-bl-sm"
|
|
17794
17738
|
),
|
|
17795
17739
|
children: [
|
|
17796
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.
|
|
17797
|
-
|
|
17798
|
-
|
|
17740
|
+
!isSent && senderField && /* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", className: "font-semibold mb-0.5", children: sender }),
|
|
17741
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "body", children: content !== void 0 && content !== null ? String(content) : "" }),
|
|
17742
|
+
timestamp != null ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
17743
|
+
exports.Typography,
|
|
17799
17744
|
{
|
|
17800
|
-
|
|
17801
|
-
className:
|
|
17802
|
-
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
size: "sm",
|
|
17807
|
-
onClick: handleActionClick(action, itemData),
|
|
17808
|
-
"data-testid": `action-${action.event}`,
|
|
17809
|
-
className: cn(
|
|
17810
|
-
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
17811
|
-
),
|
|
17812
|
-
children: [
|
|
17813
|
-
action.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
17814
|
-
action.label
|
|
17815
|
-
]
|
|
17816
|
-
},
|
|
17817
|
-
idx
|
|
17818
|
-
))
|
|
17745
|
+
variant: "caption",
|
|
17746
|
+
className: cn(
|
|
17747
|
+
"mt-1 text-[0.65rem]",
|
|
17748
|
+
isSent ? "opacity-70" : "text-muted-foreground"
|
|
17749
|
+
),
|
|
17750
|
+
children: formatDate3(timestamp)
|
|
17819
17751
|
}
|
|
17820
|
-
)
|
|
17752
|
+
) : null
|
|
17821
17753
|
]
|
|
17822
17754
|
}
|
|
17755
|
+
)
|
|
17756
|
+
},
|
|
17757
|
+
id
|
|
17758
|
+
);
|
|
17759
|
+
})
|
|
17760
|
+
] }, gi)) });
|
|
17761
|
+
}
|
|
17762
|
+
const hasRenderProp = typeof children === "function";
|
|
17763
|
+
const items = data.map((item) => item);
|
|
17764
|
+
const groups = groupBy ? groupData(items, groupBy) : [{ label: "", items }];
|
|
17765
|
+
const renderItem = (itemData, index, isLast) => {
|
|
17766
|
+
if (hasRenderProp) {
|
|
17767
|
+
const id2 = itemData.id || String(index);
|
|
17768
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { "data-entity-row": true, "data-entity-id": id2, children: [
|
|
17769
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
17770
|
+
exports.Box,
|
|
17771
|
+
{
|
|
17772
|
+
className: cn(
|
|
17773
|
+
"group flex items-center gap-4 transition-all duration-200",
|
|
17774
|
+
isCompact ? "px-4 py-2" : "px-6 py-4",
|
|
17775
|
+
"hover:bg-muted/80",
|
|
17776
|
+
!isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
|
|
17823
17777
|
),
|
|
17824
|
-
|
|
17825
|
-
|
|
17826
|
-
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
|
|
17837
|
-
|
|
17838
|
-
|
|
17839
|
-
|
|
17840
|
-
|
|
17841
|
-
|
|
17842
|
-
|
|
17843
|
-
|
|
17844
|
-
|
|
17845
|
-
|
|
17846
|
-
|
|
17847
|
-
|
|
17848
|
-
|
|
17849
|
-
|
|
17850
|
-
|
|
17851
|
-
|
|
17852
|
-
|
|
17853
|
-
|
|
17854
|
-
|
|
17855
|
-
|
|
17856
|
-
|
|
17857
|
-
|
|
17858
|
-
|
|
17859
|
-
|
|
17860
|
-
if (val === void 0 || val === null) return null;
|
|
17861
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
|
|
17862
|
-
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs" }),
|
|
17863
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: statusVariant3(String(val)), children: String(val) })
|
|
17864
|
-
] }, field.name);
|
|
17865
|
-
})
|
|
17866
|
-
] }),
|
|
17867
|
-
bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
|
|
17868
|
-
const value = getNestedValue(itemData, field.name);
|
|
17869
|
-
if (value === void 0 || value === null || value === "") return null;
|
|
17870
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center", children: [
|
|
17871
|
-
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
|
|
17872
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.Typography, { variant: "caption", color: "secondary", children: [
|
|
17873
|
-
field.label ?? fieldLabel3(field.name),
|
|
17874
|
-
":"
|
|
17875
|
-
] }),
|
|
17876
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "small", children: formatValue2(value, field.format) })
|
|
17877
|
-
] }, field.name);
|
|
17878
|
-
}) }),
|
|
17879
|
-
progressFields.map((field) => {
|
|
17880
|
-
const value = getNestedValue(itemData, field.name);
|
|
17881
|
-
if (typeof value !== "number") return null;
|
|
17882
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { className: "mt-2 max-w-xs", children: [
|
|
17883
|
-
/* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center mb-1", children: [
|
|
17884
|
-
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
|
|
17885
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
|
|
17886
|
-
] }),
|
|
17887
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.ProgressBar, { value, max: 100 })
|
|
17888
|
-
] }, field.name);
|
|
17889
|
-
})
|
|
17890
|
-
] }),
|
|
17891
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17892
|
-
exports.Button,
|
|
17893
|
-
{
|
|
17894
|
-
variant: action.variant ?? "ghost",
|
|
17895
|
-
size: "sm",
|
|
17896
|
-
onClick: handleActionClick(action, itemData),
|
|
17897
|
-
"data-testid": `action-${action.event}`,
|
|
17898
|
-
className: cn(
|
|
17899
|
-
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
17900
|
-
),
|
|
17901
|
-
children: [
|
|
17902
|
-
action.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
17903
|
-
action.label
|
|
17904
|
-
]
|
|
17905
|
-
},
|
|
17906
|
-
idx
|
|
17907
|
-
)) })
|
|
17908
|
-
]
|
|
17909
|
-
}
|
|
17910
|
-
),
|
|
17911
|
-
isCard && !isLast && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "mx-6 border-b border-border/40" })
|
|
17912
|
-
] }, id);
|
|
17913
|
-
};
|
|
17914
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17778
|
+
children: [
|
|
17779
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
|
|
17780
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17781
|
+
exports.HStack,
|
|
17782
|
+
{
|
|
17783
|
+
gap: "xs",
|
|
17784
|
+
className: "flex-shrink-0",
|
|
17785
|
+
children: itemActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17786
|
+
exports.Button,
|
|
17787
|
+
{
|
|
17788
|
+
variant: action.variant ?? "ghost",
|
|
17789
|
+
size: "sm",
|
|
17790
|
+
onClick: handleActionClick(action, itemData),
|
|
17791
|
+
"data-testid": `action-${action.event}`,
|
|
17792
|
+
className: cn(
|
|
17793
|
+
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
17794
|
+
),
|
|
17795
|
+
children: [
|
|
17796
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
17797
|
+
action.label
|
|
17798
|
+
]
|
|
17799
|
+
},
|
|
17800
|
+
idx
|
|
17801
|
+
))
|
|
17802
|
+
}
|
|
17803
|
+
)
|
|
17804
|
+
]
|
|
17805
|
+
}
|
|
17806
|
+
),
|
|
17807
|
+
isCard && !isLast && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "mx-6 border-b border-border/40" })
|
|
17808
|
+
] }, id2);
|
|
17809
|
+
}
|
|
17810
|
+
const id = itemData.id || String(index);
|
|
17811
|
+
const titleValue = getNestedValue(itemData, titleField?.name ?? "");
|
|
17812
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { "data-entity-row": true, "data-entity-id": id, children: [
|
|
17813
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
17915
17814
|
exports.Box,
|
|
17916
17815
|
{
|
|
17917
17816
|
className: cn(
|
|
17918
|
-
|
|
17919
|
-
|
|
17920
|
-
|
|
17817
|
+
"group flex items-center gap-4 transition-all duration-200",
|
|
17818
|
+
isCompact ? "px-4 py-2" : "px-6 py-4",
|
|
17819
|
+
"hover:bg-muted/80",
|
|
17820
|
+
!isCard && !isCompact && "rounded-lg border border-transparent hover:border-border"
|
|
17921
17821
|
),
|
|
17922
17822
|
children: [
|
|
17923
|
-
|
|
17924
|
-
|
|
17925
|
-
|
|
17926
|
-
|
|
17927
|
-
|
|
17928
|
-
|
|
17929
|
-
|
|
17823
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { className: "flex-1 min-w-0", children: [
|
|
17824
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "sm", className: "items-center", children: [
|
|
17825
|
+
titleField?.icon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17826
|
+
exports.Icon,
|
|
17827
|
+
{
|
|
17828
|
+
name: titleField.icon,
|
|
17829
|
+
size: isCompact ? "xs" : "sm",
|
|
17830
|
+
className: "text-primary flex-shrink-0"
|
|
17831
|
+
}
|
|
17832
|
+
),
|
|
17833
|
+
titleValue !== void 0 && titleValue !== null && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17834
|
+
exports.Typography,
|
|
17835
|
+
{
|
|
17836
|
+
variant: titleField?.variant === "h3" ? "h3" : "h4",
|
|
17837
|
+
className: cn("font-semibold truncate flex-1", isCompact && "text-sm"),
|
|
17838
|
+
children: String(titleValue)
|
|
17839
|
+
}
|
|
17840
|
+
),
|
|
17841
|
+
badgeFields.map((field) => {
|
|
17842
|
+
const val = getNestedValue(itemData, field.name);
|
|
17843
|
+
if (val === void 0 || val === null) return null;
|
|
17844
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center flex-shrink-0", children: [
|
|
17845
|
+
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs" }),
|
|
17846
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Badge, { variant: statusVariant3(String(val)), children: String(val) })
|
|
17847
|
+
] }, field.name);
|
|
17848
|
+
})
|
|
17849
|
+
] }),
|
|
17850
|
+
bodyFields.length > 0 && !isCompact && /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "md", className: "mt-1.5 flex-wrap", children: bodyFields.map((field) => {
|
|
17851
|
+
const value = getNestedValue(itemData, field.name);
|
|
17852
|
+
if (value === void 0 || value === null || value === "") return null;
|
|
17853
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center", children: [
|
|
17854
|
+
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
|
|
17855
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.Typography, { variant: "caption", color: "secondary", children: [
|
|
17856
|
+
field.label ?? fieldLabel3(field.name),
|
|
17857
|
+
":"
|
|
17858
|
+
] }),
|
|
17859
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "small", children: formatValue2(value, field.format) })
|
|
17860
|
+
] }, field.name);
|
|
17861
|
+
}) }),
|
|
17862
|
+
progressFields.map((field) => {
|
|
17863
|
+
const value = getNestedValue(itemData, field.name);
|
|
17864
|
+
if (typeof value !== "number") return null;
|
|
17865
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(exports.Box, { className: "mt-2 max-w-xs", children: [
|
|
17866
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { gap: "xs", className: "items-center mb-1", children: [
|
|
17867
|
+
field.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: field.icon, size: "xs", className: "text-muted-foreground" }),
|
|
17868
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Typography, { variant: "caption", color: "secondary", children: field.label ?? fieldLabel3(field.name) })
|
|
17869
|
+
] }),
|
|
17870
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.ProgressBar, { value, max: 100 })
|
|
17871
|
+
] }, field.name);
|
|
17872
|
+
})
|
|
17873
|
+
] }),
|
|
17874
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { gap: "xs", className: "flex-shrink-0", children: itemActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17930
17875
|
exports.Button,
|
|
17931
17876
|
{
|
|
17932
|
-
variant: "ghost",
|
|
17877
|
+
variant: action.variant ?? "ghost",
|
|
17933
17878
|
size: "sm",
|
|
17934
|
-
onClick: (
|
|
17879
|
+
onClick: handleActionClick(action, itemData),
|
|
17880
|
+
"data-testid": `action-${action.event}`,
|
|
17881
|
+
className: cn(
|
|
17882
|
+
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
17883
|
+
),
|
|
17935
17884
|
children: [
|
|
17936
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name:
|
|
17937
|
-
|
|
17938
|
-
" (",
|
|
17939
|
-
allData.length - visibleCount,
|
|
17940
|
-
" remaining)"
|
|
17885
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
17886
|
+
action.label
|
|
17941
17887
|
]
|
|
17942
|
-
}
|
|
17943
|
-
|
|
17944
|
-
|
|
17945
|
-
exports.InfiniteScrollSentinel,
|
|
17946
|
-
{
|
|
17947
|
-
loadMoreEvent,
|
|
17948
|
-
isLoading,
|
|
17949
|
-
hasMore
|
|
17950
|
-
}
|
|
17951
|
-
)
|
|
17888
|
+
},
|
|
17889
|
+
idx
|
|
17890
|
+
)) })
|
|
17952
17891
|
]
|
|
17953
17892
|
}
|
|
17954
|
-
)
|
|
17955
|
-
|
|
17956
|
-
|
|
17893
|
+
),
|
|
17894
|
+
isCard && !isLast && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "mx-6 border-b border-border/40" })
|
|
17895
|
+
] }, id);
|
|
17896
|
+
};
|
|
17897
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17898
|
+
exports.Box,
|
|
17899
|
+
{
|
|
17900
|
+
className: cn(
|
|
17901
|
+
isCard && "bg-card rounded-xl border border-border shadow-lg overflow-hidden",
|
|
17902
|
+
!isCard && gapClass,
|
|
17903
|
+
className
|
|
17904
|
+
),
|
|
17905
|
+
children: [
|
|
17906
|
+
groups.map((group, gi) => /* @__PURE__ */ jsxRuntime.jsxs(React110__namespace.default.Fragment, { children: [
|
|
17907
|
+
group.label && /* @__PURE__ */ jsxRuntime.jsx(exports.Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
|
|
17908
|
+
group.items.map(
|
|
17909
|
+
(itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
|
|
17910
|
+
)
|
|
17911
|
+
] }, gi)),
|
|
17912
|
+
hasMoreLocal && /* @__PURE__ */ jsxRuntime.jsx(exports.Box, { className: "flex justify-center py-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17913
|
+
exports.Button,
|
|
17914
|
+
{
|
|
17915
|
+
variant: "ghost",
|
|
17916
|
+
size: "sm",
|
|
17917
|
+
onClick: () => setVisibleCount((prev) => prev + (pageSize || 5)),
|
|
17918
|
+
children: [
|
|
17919
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: "chevron-down", size: "xs", className: "mr-1" }),
|
|
17920
|
+
t("common.showMore"),
|
|
17921
|
+
" (",
|
|
17922
|
+
allData.length - visibleCount,
|
|
17923
|
+
" remaining)"
|
|
17924
|
+
]
|
|
17925
|
+
}
|
|
17926
|
+
) }),
|
|
17927
|
+
infiniteScroll && loadMoreEvent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17928
|
+
exports.InfiniteScrollSentinel,
|
|
17929
|
+
{
|
|
17930
|
+
loadMoreEvent,
|
|
17931
|
+
isLoading,
|
|
17932
|
+
hasMore
|
|
17933
|
+
}
|
|
17934
|
+
)
|
|
17935
|
+
]
|
|
17936
|
+
}
|
|
17937
|
+
);
|
|
17938
|
+
}
|
|
17939
|
+
var init_DataList = __esm({
|
|
17940
|
+
"components/molecules/DataList.tsx"() {
|
|
17941
|
+
"use client";
|
|
17942
|
+
init_cn();
|
|
17943
|
+
init_getNestedValue();
|
|
17944
|
+
init_useEventBus();
|
|
17945
|
+
init_useTranslate();
|
|
17946
|
+
init_Box();
|
|
17947
|
+
init_Stack();
|
|
17948
|
+
init_Typography();
|
|
17949
|
+
init_Badge();
|
|
17950
|
+
init_Button();
|
|
17951
|
+
init_Icon();
|
|
17952
|
+
init_ProgressBar();
|
|
17953
|
+
init_Divider();
|
|
17954
|
+
init_InfiniteScrollSentinel();
|
|
17955
|
+
DataList.displayName = "DataList";
|
|
17957
17956
|
}
|
|
17958
17957
|
});
|
|
17959
17958
|
function fileIcon(name) {
|
|
@@ -19161,7 +19160,10 @@ var init_WizardProgress = __esm({
|
|
|
19161
19160
|
stepClickEvent
|
|
19162
19161
|
}) => {
|
|
19163
19162
|
const eventBus = useEventBus();
|
|
19164
|
-
const
|
|
19163
|
+
const normalizedSteps = steps.map(
|
|
19164
|
+
(s, i) => typeof s === "string" ? { id: `step-${i}`, title: s } : s
|
|
19165
|
+
);
|
|
19166
|
+
const totalSteps = normalizedSteps.length;
|
|
19165
19167
|
const handleStepClick = (index) => {
|
|
19166
19168
|
const isCompleted = index < currentStep;
|
|
19167
19169
|
if (isCompleted && allowNavigation) {
|
|
@@ -19178,7 +19180,7 @@ var init_WizardProgress = __esm({
|
|
|
19178
19180
|
compact ? "px-4 py-2" : "px-6 py-4",
|
|
19179
19181
|
className
|
|
19180
19182
|
),
|
|
19181
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children:
|
|
19183
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
|
|
19182
19184
|
const isActive = index === currentStep;
|
|
19183
19185
|
const isCompleted = index < currentStep;
|
|
19184
19186
|
return /* @__PURE__ */ jsxRuntime.jsxs(React110__namespace.default.Fragment, { children: [
|
|
@@ -36833,8 +36835,8 @@ var init_component_registry_generated = __esm({
|
|
|
36833
36835
|
"DamageNumber": DamageNumber,
|
|
36834
36836
|
"DashboardGrid": exports.DashboardGrid,
|
|
36835
36837
|
"DashboardLayout": exports.DashboardLayout,
|
|
36836
|
-
"DataGrid":
|
|
36837
|
-
"DataList":
|
|
36838
|
+
"DataGrid": DataGrid,
|
|
36839
|
+
"DataList": DataList,
|
|
36838
36840
|
"DataTable": DataTable,
|
|
36839
36841
|
"DateRangeSelector": exports.DateRangeSelector,
|
|
36840
36842
|
"DayCell": DayCell,
|
|
@@ -39779,7 +39781,7 @@ AboutPageTemplate.displayName = "AboutPageTemplate";
|
|
|
39779
39781
|
init_cn();
|
|
39780
39782
|
function useOrbitalHistory(options) {
|
|
39781
39783
|
const { appId, authToken, userId, onHistoryChange, onRevertSuccess } = options;
|
|
39782
|
-
const
|
|
39784
|
+
const getHeaders = React110.useCallback(() => {
|
|
39783
39785
|
const headers = {
|
|
39784
39786
|
"Content-Type": "application/json"
|
|
39785
39787
|
};
|
|
@@ -39800,7 +39802,7 @@ function useOrbitalHistory(options) {
|
|
|
39800
39802
|
setIsLoading(true);
|
|
39801
39803
|
setError(null);
|
|
39802
39804
|
try {
|
|
39803
|
-
const headers =
|
|
39805
|
+
const headers = getHeaders();
|
|
39804
39806
|
const [changesetsRes, snapshotsRes] = await Promise.all([
|
|
39805
39807
|
fetch(`/api/graphs/${appId}/history/changesets`, { headers }),
|
|
39806
39808
|
fetch(`/api/graphs/${appId}/history/snapshots`, { headers })
|
|
@@ -39843,7 +39845,7 @@ function useOrbitalHistory(options) {
|
|
|
39843
39845
|
} finally {
|
|
39844
39846
|
setIsLoading(false);
|
|
39845
39847
|
}
|
|
39846
|
-
}, [appId,
|
|
39848
|
+
}, [appId, getHeaders]);
|
|
39847
39849
|
const revertToSnapshot = React110.useCallback(async (snapshotId) => {
|
|
39848
39850
|
if (!appId) {
|
|
39849
39851
|
return { success: false, error: "No app ID provided" };
|
|
@@ -39851,7 +39853,7 @@ function useOrbitalHistory(options) {
|
|
|
39851
39853
|
try {
|
|
39852
39854
|
const response = await fetch(`/api/graphs/${appId}/history/revert/${snapshotId}`, {
|
|
39853
39855
|
method: "POST",
|
|
39854
|
-
headers:
|
|
39856
|
+
headers: getHeaders()
|
|
39855
39857
|
});
|
|
39856
39858
|
if (!response.ok) {
|
|
39857
39859
|
const errorData = await response.json().catch(() => ({}));
|
|
@@ -39877,7 +39879,7 @@ function useOrbitalHistory(options) {
|
|
|
39877
39879
|
error: err instanceof Error ? err.message : "Failed to revert"
|
|
39878
39880
|
};
|
|
39879
39881
|
}
|
|
39880
|
-
}, [appId,
|
|
39882
|
+
}, [appId, getHeaders, refresh, onRevertSuccess]);
|
|
39881
39883
|
React110.useEffect(() => {
|
|
39882
39884
|
if (appId && authToken && userId) {
|
|
39883
39885
|
refresh();
|
|
@@ -40941,591 +40943,10 @@ function useSelectionContext() {
|
|
|
40941
40943
|
const context = React110.useContext(providers.SelectionContext);
|
|
40942
40944
|
return context;
|
|
40943
40945
|
}
|
|
40944
|
-
var EntityDataContext = React110.createContext(null);
|
|
40945
|
-
function EntityDataProvider({
|
|
40946
|
-
adapter,
|
|
40947
|
-
children
|
|
40948
|
-
}) {
|
|
40949
|
-
return React110__namespace.default.createElement(
|
|
40950
|
-
EntityDataContext.Provider,
|
|
40951
|
-
{ value: adapter },
|
|
40952
|
-
children
|
|
40953
|
-
);
|
|
40954
|
-
}
|
|
40955
|
-
function useEntityDataAdapter() {
|
|
40956
|
-
return React110.useContext(EntityDataContext);
|
|
40957
|
-
}
|
|
40958
|
-
var entityDataKeys = {
|
|
40959
|
-
all: ["entities"],
|
|
40960
|
-
lists: () => [...entityDataKeys.all, "list"],
|
|
40961
|
-
list: (entity, filters) => [...entityDataKeys.lists(), entity, filters],
|
|
40962
|
-
details: () => [...entityDataKeys.all, "detail"],
|
|
40963
|
-
detail: (entity, id) => [...entityDataKeys.details(), entity, id]
|
|
40964
|
-
};
|
|
40965
|
-
function useEntityList(entity, options = {}) {
|
|
40966
|
-
const { skip = false } = options;
|
|
40967
|
-
const adapter = React110.useContext(EntityDataContext);
|
|
40968
|
-
const adapterData = React110.useMemo(() => {
|
|
40969
|
-
if (!adapter || !entity || skip) return [];
|
|
40970
|
-
return adapter.getData(entity);
|
|
40971
|
-
}, [adapter, entity, skip, adapter?.isLoading]);
|
|
40972
|
-
const [stubData, setStubData] = React110.useState([]);
|
|
40973
|
-
const [stubLoading, setStubLoading] = React110.useState(!skip && !!entity && !adapter);
|
|
40974
|
-
const [stubError, setStubError] = React110.useState(null);
|
|
40975
|
-
React110.useEffect(() => {
|
|
40976
|
-
if (adapter || skip || !entity) {
|
|
40977
|
-
setStubLoading(false);
|
|
40978
|
-
return;
|
|
40979
|
-
}
|
|
40980
|
-
setStubLoading(true);
|
|
40981
|
-
const t = setTimeout(() => {
|
|
40982
|
-
setStubData([]);
|
|
40983
|
-
setStubLoading(false);
|
|
40984
|
-
}, 100);
|
|
40985
|
-
return () => clearTimeout(t);
|
|
40986
|
-
}, [entity, skip, adapter]);
|
|
40987
|
-
if (adapter) {
|
|
40988
|
-
return {
|
|
40989
|
-
data: adapterData,
|
|
40990
|
-
isLoading: adapter.isLoading,
|
|
40991
|
-
error: adapter.error ? new Error(adapter.error) : null,
|
|
40992
|
-
refetch: () => {
|
|
40993
|
-
}
|
|
40994
|
-
};
|
|
40995
|
-
}
|
|
40996
|
-
return { data: stubData, isLoading: stubLoading, error: stubError, refetch: () => {
|
|
40997
|
-
} };
|
|
40998
|
-
}
|
|
40999
|
-
function useEntity(entity, id) {
|
|
41000
|
-
const adapter = React110.useContext(EntityDataContext);
|
|
41001
|
-
const adapterData = React110.useMemo(() => {
|
|
41002
|
-
if (!adapter || !entity || !id) return null;
|
|
41003
|
-
return adapter.getById(entity, id) ?? null;
|
|
41004
|
-
}, [adapter, entity, id, adapter?.isLoading]);
|
|
41005
|
-
const [stubData, setStubData] = React110.useState(null);
|
|
41006
|
-
const [stubLoading, setStubLoading] = React110.useState(!!entity && !!id && !adapter);
|
|
41007
|
-
const [stubError, setStubError] = React110.useState(null);
|
|
41008
|
-
React110.useEffect(() => {
|
|
41009
|
-
if (adapter || !entity || !id) {
|
|
41010
|
-
setStubLoading(false);
|
|
41011
|
-
return;
|
|
41012
|
-
}
|
|
41013
|
-
setStubLoading(true);
|
|
41014
|
-
const t = setTimeout(() => {
|
|
41015
|
-
setStubData(null);
|
|
41016
|
-
setStubLoading(false);
|
|
41017
|
-
}, 100);
|
|
41018
|
-
return () => clearTimeout(t);
|
|
41019
|
-
}, [entity, id, adapter]);
|
|
41020
|
-
if (adapter) {
|
|
41021
|
-
return {
|
|
41022
|
-
data: adapterData,
|
|
41023
|
-
isLoading: adapter.isLoading,
|
|
41024
|
-
error: adapter.error ? new Error(adapter.error) : null
|
|
41025
|
-
};
|
|
41026
|
-
}
|
|
41027
|
-
return { data: stubData, isLoading: stubLoading, error: stubError };
|
|
41028
|
-
}
|
|
41029
|
-
function useEntityDetail(entity, id) {
|
|
41030
|
-
const result = useEntity(entity, id);
|
|
41031
|
-
return { ...result, refetch: () => {
|
|
41032
|
-
} };
|
|
41033
|
-
}
|
|
41034
|
-
var suspenseCache = /* @__PURE__ */ new Map();
|
|
41035
|
-
function getSuspenseCacheKey(entity, type, id) {
|
|
41036
|
-
return id ? `${type}:${entity}:${id}` : `${type}:${entity}`;
|
|
41037
|
-
}
|
|
41038
|
-
function useEntityListSuspense(entity) {
|
|
41039
|
-
const adapter = React110.useContext(EntityDataContext);
|
|
41040
|
-
if (adapter) {
|
|
41041
|
-
if (adapter.isLoading) {
|
|
41042
|
-
const cacheKey2 = getSuspenseCacheKey(entity, "list");
|
|
41043
|
-
let entry2 = suspenseCache.get(cacheKey2);
|
|
41044
|
-
if (!entry2 || entry2.status === "resolved") {
|
|
41045
|
-
let resolve;
|
|
41046
|
-
const promise = new Promise((r) => {
|
|
41047
|
-
resolve = r;
|
|
41048
|
-
});
|
|
41049
|
-
entry2 = { promise, status: "pending" };
|
|
41050
|
-
suspenseCache.set(cacheKey2, entry2);
|
|
41051
|
-
const check = setInterval(() => {
|
|
41052
|
-
if (!adapter.isLoading) {
|
|
41053
|
-
clearInterval(check);
|
|
41054
|
-
entry2.status = "resolved";
|
|
41055
|
-
resolve();
|
|
41056
|
-
}
|
|
41057
|
-
}, 50);
|
|
41058
|
-
}
|
|
41059
|
-
if (entry2.status === "pending") {
|
|
41060
|
-
throw entry2.promise;
|
|
41061
|
-
}
|
|
41062
|
-
}
|
|
41063
|
-
if (adapter.error) {
|
|
41064
|
-
throw new Error(adapter.error);
|
|
41065
|
-
}
|
|
41066
|
-
return {
|
|
41067
|
-
data: adapter.getData(entity),
|
|
41068
|
-
refetch: () => {
|
|
41069
|
-
}
|
|
41070
|
-
};
|
|
41071
|
-
}
|
|
41072
|
-
const cacheKey = getSuspenseCacheKey(entity, "list");
|
|
41073
|
-
let entry = suspenseCache.get(cacheKey);
|
|
41074
|
-
if (!entry) {
|
|
41075
|
-
let resolve;
|
|
41076
|
-
const promise = new Promise((r) => {
|
|
41077
|
-
resolve = r;
|
|
41078
|
-
setTimeout(() => {
|
|
41079
|
-
entry.status = "resolved";
|
|
41080
|
-
resolve();
|
|
41081
|
-
}, 100);
|
|
41082
|
-
});
|
|
41083
|
-
entry = { promise, status: "pending" };
|
|
41084
|
-
suspenseCache.set(cacheKey, entry);
|
|
41085
|
-
}
|
|
41086
|
-
if (entry.status === "pending") {
|
|
41087
|
-
throw entry.promise;
|
|
41088
|
-
}
|
|
41089
|
-
return { data: [], refetch: () => {
|
|
41090
|
-
} };
|
|
41091
|
-
}
|
|
41092
|
-
function useEntitySuspense(entity, id) {
|
|
41093
|
-
const adapter = React110.useContext(EntityDataContext);
|
|
41094
|
-
if (adapter) {
|
|
41095
|
-
if (adapter.isLoading) {
|
|
41096
|
-
const cacheKey2 = getSuspenseCacheKey(entity, "detail", id);
|
|
41097
|
-
let entry2 = suspenseCache.get(cacheKey2);
|
|
41098
|
-
if (!entry2 || entry2.status === "resolved") {
|
|
41099
|
-
let resolve;
|
|
41100
|
-
const promise = new Promise((r) => {
|
|
41101
|
-
resolve = r;
|
|
41102
|
-
});
|
|
41103
|
-
entry2 = { promise, status: "pending" };
|
|
41104
|
-
suspenseCache.set(cacheKey2, entry2);
|
|
41105
|
-
const check = setInterval(() => {
|
|
41106
|
-
if (!adapter.isLoading) {
|
|
41107
|
-
clearInterval(check);
|
|
41108
|
-
entry2.status = "resolved";
|
|
41109
|
-
resolve();
|
|
41110
|
-
}
|
|
41111
|
-
}, 50);
|
|
41112
|
-
}
|
|
41113
|
-
if (entry2.status === "pending") {
|
|
41114
|
-
throw entry2.promise;
|
|
41115
|
-
}
|
|
41116
|
-
}
|
|
41117
|
-
if (adapter.error) {
|
|
41118
|
-
throw new Error(adapter.error);
|
|
41119
|
-
}
|
|
41120
|
-
return {
|
|
41121
|
-
data: adapter.getById(entity, id) ?? null,
|
|
41122
|
-
refetch: () => {
|
|
41123
|
-
}
|
|
41124
|
-
};
|
|
41125
|
-
}
|
|
41126
|
-
const cacheKey = getSuspenseCacheKey(entity, "detail", id);
|
|
41127
|
-
let entry = suspenseCache.get(cacheKey);
|
|
41128
|
-
if (!entry) {
|
|
41129
|
-
let resolve;
|
|
41130
|
-
const promise = new Promise((r) => {
|
|
41131
|
-
resolve = r;
|
|
41132
|
-
setTimeout(() => {
|
|
41133
|
-
entry.status = "resolved";
|
|
41134
|
-
resolve();
|
|
41135
|
-
}, 100);
|
|
41136
|
-
});
|
|
41137
|
-
entry = { promise, status: "pending" };
|
|
41138
|
-
suspenseCache.set(cacheKey, entry);
|
|
41139
|
-
}
|
|
41140
|
-
if (entry.status === "pending") {
|
|
41141
|
-
throw entry.promise;
|
|
41142
|
-
}
|
|
41143
|
-
return { data: null, refetch: () => {
|
|
41144
|
-
} };
|
|
41145
|
-
}
|
|
41146
40946
|
|
|
41147
40947
|
// hooks/index.ts
|
|
41148
40948
|
init_useQuerySingleton();
|
|
41149
40949
|
|
|
41150
|
-
// lib/api-client.ts
|
|
41151
|
-
var API_BASE_URL = typeof process !== "undefined" && process.env?.VITE_API_URL ? process.env.VITE_API_URL : "/api";
|
|
41152
|
-
var ApiError = class extends Error {
|
|
41153
|
-
constructor(status, statusText, message) {
|
|
41154
|
-
super(message || `API Error: ${status} ${statusText}`);
|
|
41155
|
-
__publicField(this, "status", status);
|
|
41156
|
-
__publicField(this, "statusText", statusText);
|
|
41157
|
-
this.name = "ApiError";
|
|
41158
|
-
}
|
|
41159
|
-
};
|
|
41160
|
-
async function handleResponse(response) {
|
|
41161
|
-
if (!response.ok) {
|
|
41162
|
-
let message;
|
|
41163
|
-
try {
|
|
41164
|
-
const errorData = await response.json();
|
|
41165
|
-
message = errorData.message || errorData.error;
|
|
41166
|
-
} catch {
|
|
41167
|
-
}
|
|
41168
|
-
throw new ApiError(response.status, response.statusText, message);
|
|
41169
|
-
}
|
|
41170
|
-
const text = await response.text();
|
|
41171
|
-
if (!text) {
|
|
41172
|
-
return void 0;
|
|
41173
|
-
}
|
|
41174
|
-
return JSON.parse(text);
|
|
41175
|
-
}
|
|
41176
|
-
function getHeaders() {
|
|
41177
|
-
const headers = {
|
|
41178
|
-
"Content-Type": "application/json"
|
|
41179
|
-
};
|
|
41180
|
-
const token = typeof localStorage !== "undefined" ? localStorage.getItem("authToken") : null;
|
|
41181
|
-
if (token) {
|
|
41182
|
-
headers["Authorization"] = `Bearer ${token}`;
|
|
41183
|
-
}
|
|
41184
|
-
return headers;
|
|
41185
|
-
}
|
|
41186
|
-
var apiClient = {
|
|
41187
|
-
/**
|
|
41188
|
-
* GET request
|
|
41189
|
-
*/
|
|
41190
|
-
async get(endpoint) {
|
|
41191
|
-
const response = await fetch(`${API_BASE_URL}${endpoint}`, {
|
|
41192
|
-
method: "GET",
|
|
41193
|
-
headers: getHeaders()
|
|
41194
|
-
});
|
|
41195
|
-
return handleResponse(response);
|
|
41196
|
-
},
|
|
41197
|
-
/**
|
|
41198
|
-
* POST request
|
|
41199
|
-
*/
|
|
41200
|
-
async post(endpoint, data) {
|
|
41201
|
-
const response = await fetch(`${API_BASE_URL}${endpoint}`, {
|
|
41202
|
-
method: "POST",
|
|
41203
|
-
headers: getHeaders(),
|
|
41204
|
-
body: data ? JSON.stringify(data) : void 0
|
|
41205
|
-
});
|
|
41206
|
-
return handleResponse(response);
|
|
41207
|
-
},
|
|
41208
|
-
/**
|
|
41209
|
-
* PUT request
|
|
41210
|
-
*/
|
|
41211
|
-
async put(endpoint, data) {
|
|
41212
|
-
const response = await fetch(`${API_BASE_URL}${endpoint}`, {
|
|
41213
|
-
method: "PUT",
|
|
41214
|
-
headers: getHeaders(),
|
|
41215
|
-
body: data ? JSON.stringify(data) : void 0
|
|
41216
|
-
});
|
|
41217
|
-
return handleResponse(response);
|
|
41218
|
-
},
|
|
41219
|
-
/**
|
|
41220
|
-
* PATCH request
|
|
41221
|
-
*/
|
|
41222
|
-
async patch(endpoint, data) {
|
|
41223
|
-
const response = await fetch(`${API_BASE_URL}${endpoint}`, {
|
|
41224
|
-
method: "PATCH",
|
|
41225
|
-
headers: getHeaders(),
|
|
41226
|
-
body: data ? JSON.stringify(data) : void 0
|
|
41227
|
-
});
|
|
41228
|
-
return handleResponse(response);
|
|
41229
|
-
},
|
|
41230
|
-
/**
|
|
41231
|
-
* DELETE request
|
|
41232
|
-
*/
|
|
41233
|
-
async delete(endpoint) {
|
|
41234
|
-
const response = await fetch(`${API_BASE_URL}${endpoint}`, {
|
|
41235
|
-
method: "DELETE",
|
|
41236
|
-
headers: getHeaders()
|
|
41237
|
-
});
|
|
41238
|
-
return handleResponse(response);
|
|
41239
|
-
}
|
|
41240
|
-
};
|
|
41241
|
-
var ENTITY_EVENTS = {
|
|
41242
|
-
CREATE: "ENTITY_CREATE",
|
|
41243
|
-
UPDATE: "ENTITY_UPDATE",
|
|
41244
|
-
DELETE: "ENTITY_DELETE"
|
|
41245
|
-
};
|
|
41246
|
-
async function sendOrbitalEvent(orbitalName, eventPayload) {
|
|
41247
|
-
const response = await apiClient.post(
|
|
41248
|
-
`/orbitals/${orbitalName}/events`,
|
|
41249
|
-
eventPayload
|
|
41250
|
-
);
|
|
41251
|
-
return response;
|
|
41252
|
-
}
|
|
41253
|
-
function useOrbitalMutations(entityName, orbitalName, options) {
|
|
41254
|
-
const queryClient = reactQuery.useQueryClient();
|
|
41255
|
-
const events2 = {
|
|
41256
|
-
create: options?.events?.create || ENTITY_EVENTS.CREATE,
|
|
41257
|
-
update: options?.events?.update || ENTITY_EVENTS.UPDATE,
|
|
41258
|
-
delete: options?.events?.delete || ENTITY_EVENTS.DELETE
|
|
41259
|
-
};
|
|
41260
|
-
const log3 = (message, data) => {
|
|
41261
|
-
if (options?.debug) {
|
|
41262
|
-
console.log(`[useOrbitalMutations:${orbitalName}] ${message}`, data ?? "");
|
|
41263
|
-
}
|
|
41264
|
-
};
|
|
41265
|
-
const createMutation = reactQuery.useMutation({
|
|
41266
|
-
mutationFn: async (data) => {
|
|
41267
|
-
log3("Creating entity", data);
|
|
41268
|
-
return sendOrbitalEvent(orbitalName, {
|
|
41269
|
-
event: events2.create,
|
|
41270
|
-
payload: { data, entityType: entityName }
|
|
41271
|
-
});
|
|
41272
|
-
},
|
|
41273
|
-
onSuccess: (response) => {
|
|
41274
|
-
log3("Create succeeded", response);
|
|
41275
|
-
queryClient.invalidateQueries({ queryKey: entityDataKeys.list(entityName) });
|
|
41276
|
-
},
|
|
41277
|
-
onError: (error) => {
|
|
41278
|
-
console.error(`[useOrbitalMutations] Create failed:`, error);
|
|
41279
|
-
}
|
|
41280
|
-
});
|
|
41281
|
-
const updateMutation = reactQuery.useMutation({
|
|
41282
|
-
mutationFn: async ({
|
|
41283
|
-
id,
|
|
41284
|
-
data
|
|
41285
|
-
}) => {
|
|
41286
|
-
log3(`Updating entity ${id}`, data);
|
|
41287
|
-
return sendOrbitalEvent(orbitalName, {
|
|
41288
|
-
event: events2.update,
|
|
41289
|
-
entityId: id,
|
|
41290
|
-
payload: { data, entityType: entityName }
|
|
41291
|
-
});
|
|
41292
|
-
},
|
|
41293
|
-
onSuccess: (response, variables) => {
|
|
41294
|
-
log3("Update succeeded", response);
|
|
41295
|
-
queryClient.invalidateQueries({ queryKey: entityDataKeys.list(entityName) });
|
|
41296
|
-
queryClient.invalidateQueries({
|
|
41297
|
-
queryKey: entityDataKeys.detail(entityName, variables.id)
|
|
41298
|
-
});
|
|
41299
|
-
},
|
|
41300
|
-
onError: (error) => {
|
|
41301
|
-
console.error(`[useOrbitalMutations] Update failed:`, error);
|
|
41302
|
-
}
|
|
41303
|
-
});
|
|
41304
|
-
const deleteMutation = reactQuery.useMutation({
|
|
41305
|
-
mutationFn: async (id) => {
|
|
41306
|
-
log3(`Deleting entity ${id}`);
|
|
41307
|
-
return sendOrbitalEvent(orbitalName, {
|
|
41308
|
-
event: events2.delete,
|
|
41309
|
-
entityId: id,
|
|
41310
|
-
payload: { entityType: entityName }
|
|
41311
|
-
});
|
|
41312
|
-
},
|
|
41313
|
-
onSuccess: (response, id) => {
|
|
41314
|
-
log3("Delete succeeded", response);
|
|
41315
|
-
queryClient.invalidateQueries({ queryKey: entityDataKeys.list(entityName) });
|
|
41316
|
-
queryClient.removeQueries({ queryKey: entityDataKeys.detail(entityName, id) });
|
|
41317
|
-
},
|
|
41318
|
-
onError: (error) => {
|
|
41319
|
-
console.error(`[useOrbitalMutations] Delete failed:`, error);
|
|
41320
|
-
}
|
|
41321
|
-
});
|
|
41322
|
-
return {
|
|
41323
|
-
// Async functions
|
|
41324
|
-
createEntity: async (data) => {
|
|
41325
|
-
return createMutation.mutateAsync(data);
|
|
41326
|
-
},
|
|
41327
|
-
updateEntity: async (id, data) => {
|
|
41328
|
-
if (!id) {
|
|
41329
|
-
console.warn("[useOrbitalMutations] Cannot update without ID");
|
|
41330
|
-
return;
|
|
41331
|
-
}
|
|
41332
|
-
return updateMutation.mutateAsync({ id, data });
|
|
41333
|
-
},
|
|
41334
|
-
deleteEntity: async (id) => {
|
|
41335
|
-
if (!id) {
|
|
41336
|
-
console.warn("[useOrbitalMutations] Cannot delete without ID");
|
|
41337
|
-
return;
|
|
41338
|
-
}
|
|
41339
|
-
return deleteMutation.mutateAsync(id);
|
|
41340
|
-
},
|
|
41341
|
-
// Mutation objects for fine-grained control
|
|
41342
|
-
createMutation,
|
|
41343
|
-
updateMutation,
|
|
41344
|
-
deleteMutation,
|
|
41345
|
-
// Aggregate states
|
|
41346
|
-
isCreating: createMutation.isPending,
|
|
41347
|
-
isUpdating: updateMutation.isPending,
|
|
41348
|
-
isDeleting: deleteMutation.isPending,
|
|
41349
|
-
isMutating: createMutation.isPending || updateMutation.isPending || deleteMutation.isPending,
|
|
41350
|
-
// Errors
|
|
41351
|
-
createError: createMutation.error,
|
|
41352
|
-
updateError: updateMutation.error,
|
|
41353
|
-
deleteError: deleteMutation.error
|
|
41354
|
-
};
|
|
41355
|
-
}
|
|
41356
|
-
function useSendOrbitalEvent(orbitalName) {
|
|
41357
|
-
const mutation = reactQuery.useMutation({
|
|
41358
|
-
mutationFn: async (payload) => {
|
|
41359
|
-
return sendOrbitalEvent(orbitalName, payload);
|
|
41360
|
-
}
|
|
41361
|
-
});
|
|
41362
|
-
return {
|
|
41363
|
-
sendEvent: async (event, payload, entityId) => {
|
|
41364
|
-
return mutation.mutateAsync({ event, payload, entityId });
|
|
41365
|
-
},
|
|
41366
|
-
isPending: mutation.isPending,
|
|
41367
|
-
error: mutation.error,
|
|
41368
|
-
data: mutation.data
|
|
41369
|
-
};
|
|
41370
|
-
}
|
|
41371
|
-
|
|
41372
|
-
// hooks/useEntityMutations.ts
|
|
41373
|
-
function entityToCollection(entityName) {
|
|
41374
|
-
return entityName.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase() + "-list";
|
|
41375
|
-
}
|
|
41376
|
-
function useCreateEntity(entityName) {
|
|
41377
|
-
const queryClient = reactQuery.useQueryClient();
|
|
41378
|
-
const collection = entityToCollection(entityName);
|
|
41379
|
-
return reactQuery.useMutation({
|
|
41380
|
-
mutationFn: async (data) => {
|
|
41381
|
-
console.log(`[useCreateEntity] Creating ${entityName}:`, data);
|
|
41382
|
-
const response = await apiClient.post(
|
|
41383
|
-
`/${collection}`,
|
|
41384
|
-
data
|
|
41385
|
-
);
|
|
41386
|
-
return response.data;
|
|
41387
|
-
},
|
|
41388
|
-
onSuccess: () => {
|
|
41389
|
-
queryClient.invalidateQueries({ queryKey: entityDataKeys.list(entityName) });
|
|
41390
|
-
},
|
|
41391
|
-
onError: (error) => {
|
|
41392
|
-
console.error(`[useCreateEntity] Failed to create ${entityName}:`, error);
|
|
41393
|
-
}
|
|
41394
|
-
});
|
|
41395
|
-
}
|
|
41396
|
-
function useUpdateEntity(entityName) {
|
|
41397
|
-
const queryClient = reactQuery.useQueryClient();
|
|
41398
|
-
const collection = entityToCollection(entityName);
|
|
41399
|
-
return reactQuery.useMutation({
|
|
41400
|
-
mutationFn: async ({ id, data }) => {
|
|
41401
|
-
console.log(`[useUpdateEntity] Updating ${entityName} ${id}:`, data);
|
|
41402
|
-
const response = await apiClient.patch(
|
|
41403
|
-
`/${collection}/${id}`,
|
|
41404
|
-
data
|
|
41405
|
-
);
|
|
41406
|
-
return response.data;
|
|
41407
|
-
},
|
|
41408
|
-
onSuccess: (_, variables) => {
|
|
41409
|
-
queryClient.invalidateQueries({ queryKey: entityDataKeys.list(entityName) });
|
|
41410
|
-
queryClient.invalidateQueries({ queryKey: entityDataKeys.detail(entityName, variables.id) });
|
|
41411
|
-
},
|
|
41412
|
-
onError: (error) => {
|
|
41413
|
-
console.error(`[useUpdateEntity] Failed to update ${entityName}:`, error);
|
|
41414
|
-
}
|
|
41415
|
-
});
|
|
41416
|
-
}
|
|
41417
|
-
function useDeleteEntity(entityName) {
|
|
41418
|
-
const queryClient = reactQuery.useQueryClient();
|
|
41419
|
-
const collection = entityToCollection(entityName);
|
|
41420
|
-
return reactQuery.useMutation({
|
|
41421
|
-
mutationFn: async (id) => {
|
|
41422
|
-
console.log(`[useDeleteEntity] Deleting ${entityName} ${id}`);
|
|
41423
|
-
await apiClient.delete(`/${collection}/${id}`);
|
|
41424
|
-
return { id };
|
|
41425
|
-
},
|
|
41426
|
-
onSuccess: (_, id) => {
|
|
41427
|
-
queryClient.invalidateQueries({ queryKey: entityDataKeys.list(entityName) });
|
|
41428
|
-
queryClient.removeQueries({ queryKey: entityDataKeys.detail(entityName, id) });
|
|
41429
|
-
},
|
|
41430
|
-
onError: (error) => {
|
|
41431
|
-
console.error(`[useDeleteEntity] Failed to delete ${entityName}:`, error);
|
|
41432
|
-
}
|
|
41433
|
-
});
|
|
41434
|
-
}
|
|
41435
|
-
async function sendOrbitalMutation(orbitalName, event, entityId, payload) {
|
|
41436
|
-
const response = await apiClient.post(
|
|
41437
|
-
`/orbitals/${orbitalName}/events`,
|
|
41438
|
-
{ event, entityId, payload }
|
|
41439
|
-
);
|
|
41440
|
-
return response;
|
|
41441
|
-
}
|
|
41442
|
-
function useEntityMutations(entityName, options) {
|
|
41443
|
-
const queryClient = reactQuery.useQueryClient();
|
|
41444
|
-
const useOrbitalRoute = !!options?.orbitalName;
|
|
41445
|
-
const events2 = {
|
|
41446
|
-
create: options?.events?.create || ENTITY_EVENTS.CREATE,
|
|
41447
|
-
update: options?.events?.update || ENTITY_EVENTS.UPDATE,
|
|
41448
|
-
delete: options?.events?.delete || ENTITY_EVENTS.DELETE
|
|
41449
|
-
};
|
|
41450
|
-
const createMutation = useCreateEntity(entityName);
|
|
41451
|
-
const updateMutation = useUpdateEntity(entityName);
|
|
41452
|
-
const deleteMutation = useDeleteEntity(entityName);
|
|
41453
|
-
const orbitalCreateMutation = reactQuery.useMutation({
|
|
41454
|
-
mutationFn: async (data) => {
|
|
41455
|
-
return sendOrbitalMutation(options.orbitalName, events2.create, void 0, {
|
|
41456
|
-
data,
|
|
41457
|
-
entityType: entityName
|
|
41458
|
-
});
|
|
41459
|
-
},
|
|
41460
|
-
onSuccess: () => {
|
|
41461
|
-
queryClient.invalidateQueries({ queryKey: entityDataKeys.list(entityName) });
|
|
41462
|
-
}
|
|
41463
|
-
});
|
|
41464
|
-
const orbitalUpdateMutation = reactQuery.useMutation({
|
|
41465
|
-
mutationFn: async ({ id, data }) => {
|
|
41466
|
-
return sendOrbitalMutation(options.orbitalName, events2.update, id, {
|
|
41467
|
-
data,
|
|
41468
|
-
entityType: entityName
|
|
41469
|
-
});
|
|
41470
|
-
},
|
|
41471
|
-
onSuccess: (_, variables) => {
|
|
41472
|
-
queryClient.invalidateQueries({ queryKey: entityDataKeys.list(entityName) });
|
|
41473
|
-
queryClient.invalidateQueries({
|
|
41474
|
-
queryKey: entityDataKeys.detail(entityName, variables.id)
|
|
41475
|
-
});
|
|
41476
|
-
}
|
|
41477
|
-
});
|
|
41478
|
-
const orbitalDeleteMutation = reactQuery.useMutation({
|
|
41479
|
-
mutationFn: async (id) => {
|
|
41480
|
-
return sendOrbitalMutation(options.orbitalName, events2.delete, id, {
|
|
41481
|
-
entityType: entityName
|
|
41482
|
-
});
|
|
41483
|
-
},
|
|
41484
|
-
onSuccess: (_, id) => {
|
|
41485
|
-
queryClient.invalidateQueries({ queryKey: entityDataKeys.list(entityName) });
|
|
41486
|
-
queryClient.removeQueries({ queryKey: entityDataKeys.detail(entityName, id) });
|
|
41487
|
-
}
|
|
41488
|
-
});
|
|
41489
|
-
const activeMutations = {
|
|
41490
|
-
create: useOrbitalRoute ? orbitalCreateMutation : createMutation,
|
|
41491
|
-
update: useOrbitalRoute ? orbitalUpdateMutation : updateMutation,
|
|
41492
|
-
delete: useOrbitalRoute ? orbitalDeleteMutation : deleteMutation
|
|
41493
|
-
};
|
|
41494
|
-
return {
|
|
41495
|
-
// Async functions that can be called directly
|
|
41496
|
-
// Accepts either (data) or (entityName, data) for compiler compatibility
|
|
41497
|
-
createEntity: async (entityOrData, data) => {
|
|
41498
|
-
const actualData = typeof entityOrData === "string" ? data : entityOrData;
|
|
41499
|
-
if (!actualData) {
|
|
41500
|
-
console.warn("[useEntityMutations] Cannot create entity without data");
|
|
41501
|
-
return;
|
|
41502
|
-
}
|
|
41503
|
-
return activeMutations.create.mutateAsync(actualData);
|
|
41504
|
-
},
|
|
41505
|
-
updateEntity: async (id, data) => {
|
|
41506
|
-
if (!id) {
|
|
41507
|
-
console.warn("[useEntityMutations] Cannot update entity without ID");
|
|
41508
|
-
return;
|
|
41509
|
-
}
|
|
41510
|
-
return activeMutations.update.mutateAsync({ id, data });
|
|
41511
|
-
},
|
|
41512
|
-
deleteEntity: async (id) => {
|
|
41513
|
-
if (!id) {
|
|
41514
|
-
console.warn("[useEntityMutations] Cannot delete entity without ID");
|
|
41515
|
-
return;
|
|
41516
|
-
}
|
|
41517
|
-
return activeMutations.delete.mutateAsync(id);
|
|
41518
|
-
},
|
|
41519
|
-
// Mutation states for UI feedback
|
|
41520
|
-
isCreating: activeMutations.create.isPending,
|
|
41521
|
-
isUpdating: activeMutations.update.isPending,
|
|
41522
|
-
isDeleting: activeMutations.delete.isPending,
|
|
41523
|
-
createError: activeMutations.create.error,
|
|
41524
|
-
updateError: activeMutations.update.error,
|
|
41525
|
-
deleteError: activeMutations.delete.error
|
|
41526
|
-
};
|
|
41527
|
-
}
|
|
41528
|
-
|
|
41529
40950
|
// stores/entityStore.ts
|
|
41530
40951
|
var entities = /* @__PURE__ */ new Map();
|
|
41531
40952
|
var listeners6 = /* @__PURE__ */ new Set();
|
|
@@ -41603,7 +41024,7 @@ function useEntities() {
|
|
|
41603
41024
|
clearEntities
|
|
41604
41025
|
};
|
|
41605
41026
|
}
|
|
41606
|
-
function
|
|
41027
|
+
function useEntity(id) {
|
|
41607
41028
|
const entities2 = React110.useSyncExternalStore(subscribe, getSnapshot2, getSnapshot2);
|
|
41608
41029
|
return entities2.get(id);
|
|
41609
41030
|
}
|
|
@@ -41639,28 +41060,6 @@ function useInput() {
|
|
|
41639
41060
|
|
|
41640
41061
|
// hooks/index.ts
|
|
41641
41062
|
init_useTranslate();
|
|
41642
|
-
function useResolvedEntity(entity, data) {
|
|
41643
|
-
const shouldFetch = !data && !!entity;
|
|
41644
|
-
const fetched = useEntityList(entity, { skip: !shouldFetch });
|
|
41645
|
-
return React110.useMemo(() => {
|
|
41646
|
-
if (data) {
|
|
41647
|
-
return {
|
|
41648
|
-
data,
|
|
41649
|
-
isLocal: true,
|
|
41650
|
-
isLoading: false,
|
|
41651
|
-
error: null
|
|
41652
|
-
};
|
|
41653
|
-
}
|
|
41654
|
-
return {
|
|
41655
|
-
data: fetched.data,
|
|
41656
|
-
isLocal: false,
|
|
41657
|
-
isLoading: fetched.isLoading,
|
|
41658
|
-
error: fetched.error
|
|
41659
|
-
};
|
|
41660
|
-
}, [data, fetched.data, fetched.isLoading, fetched.error]);
|
|
41661
|
-
}
|
|
41662
|
-
|
|
41663
|
-
// hooks/index.ts
|
|
41664
41063
|
init_useAuthContext();
|
|
41665
41064
|
init_useSwipeGesture();
|
|
41666
41065
|
init_useLongPress();
|
|
@@ -41910,20 +41309,20 @@ exports.CraftingRecipe = CraftingRecipe;
|
|
|
41910
41309
|
exports.DEFAULT_SLOTS = DEFAULT_SLOTS;
|
|
41911
41310
|
exports.DPad = DPad;
|
|
41912
41311
|
exports.DamageNumber = DamageNumber;
|
|
41312
|
+
exports.DataGrid = DataGrid;
|
|
41313
|
+
exports.DataList = DataList;
|
|
41913
41314
|
exports.DataTable = DataTable;
|
|
41914
41315
|
exports.DayCell = DayCell;
|
|
41915
41316
|
exports.DebuggerBoard = DebuggerBoard;
|
|
41916
41317
|
exports.DialogueBox = DialogueBox;
|
|
41917
41318
|
exports.DialogueBubble = DialogueBubble;
|
|
41918
41319
|
exports.DomStateMachineVisualizer = exports.StateMachineView;
|
|
41919
|
-
exports.ENTITY_EVENTS = ENTITY_EVENTS;
|
|
41920
41320
|
exports.EditorCheckbox = EditorCheckbox;
|
|
41921
41321
|
exports.EditorSelect = EditorSelect;
|
|
41922
41322
|
exports.EditorSlider = EditorSlider;
|
|
41923
41323
|
exports.EditorTextInput = EditorTextInput;
|
|
41924
41324
|
exports.EditorToolbar = EditorToolbar;
|
|
41925
41325
|
exports.EnemyPlate = EnemyPlate;
|
|
41926
|
-
exports.EntityDataProvider = EntityDataProvider;
|
|
41927
41326
|
exports.EventHandlerBoard = EventHandlerBoard;
|
|
41928
41327
|
exports.EventLog = EventLog;
|
|
41929
41328
|
exports.FEATURE_TYPES = FEATURE_TYPES;
|
|
@@ -42018,7 +41417,6 @@ exports.createInitialGameState = createInitialGameState;
|
|
|
42018
41417
|
exports.createTranslate = createTranslate;
|
|
42019
41418
|
exports.createUnitAnimationState = createUnitAnimationState;
|
|
42020
41419
|
exports.drawSprite = drawSprite;
|
|
42021
|
-
exports.entityDataKeys = entityDataKeys;
|
|
42022
41420
|
exports.generateCombatMessage = generateCombatMessage;
|
|
42023
41421
|
exports.getAllEntities = getAllEntities;
|
|
42024
41422
|
exports.getByType = getByType;
|
|
@@ -42046,9 +41444,7 @@ exports.useBattleState = useBattleState;
|
|
|
42046
41444
|
exports.useCamera = useCamera;
|
|
42047
41445
|
exports.useCompile = useCompile;
|
|
42048
41446
|
exports.useConnectGitHub = useConnectGitHub;
|
|
42049
|
-
exports.useCreateEntity = useCreateEntity;
|
|
42050
41447
|
exports.useDeepAgentGeneration = useDeepAgentGeneration;
|
|
42051
|
-
exports.useDeleteEntity = useDeleteEntity;
|
|
42052
41448
|
exports.useDisconnectGitHub = useDisconnectGitHub;
|
|
42053
41449
|
exports.useDragReorder = useDragReorder;
|
|
42054
41450
|
exports.useDraggable = useDraggable;
|
|
@@ -42056,14 +41452,7 @@ exports.useDropZone = useDropZone;
|
|
|
42056
41452
|
exports.useEmitEvent = useEmitEvent;
|
|
42057
41453
|
exports.useEntities = useEntities;
|
|
42058
41454
|
exports.useEntitiesByType = useEntitiesByType;
|
|
42059
|
-
exports.
|
|
42060
|
-
exports.useEntityById = useEntity2;
|
|
42061
|
-
exports.useEntityDataAdapter = useEntityDataAdapter;
|
|
42062
|
-
exports.useEntityDetail = useEntityDetail;
|
|
42063
|
-
exports.useEntityList = useEntityList;
|
|
42064
|
-
exports.useEntityListSuspense = useEntityListSuspense;
|
|
42065
|
-
exports.useEntityMutations = useEntityMutations;
|
|
42066
|
-
exports.useEntitySuspense = useEntitySuspense;
|
|
41455
|
+
exports.useEntityById = useEntity;
|
|
42067
41456
|
exports.useEventBus = useEventBus;
|
|
42068
41457
|
exports.useEventListener = useEventListener;
|
|
42069
41458
|
exports.useExtensions = useExtensions;
|
|
@@ -42080,7 +41469,6 @@ exports.useInfiniteScroll = useInfiniteScroll;
|
|
|
42080
41469
|
exports.useInput = useInput;
|
|
42081
41470
|
exports.useLongPress = useLongPress;
|
|
42082
41471
|
exports.useOrbitalHistory = useOrbitalHistory;
|
|
42083
|
-
exports.useOrbitalMutations = useOrbitalMutations;
|
|
42084
41472
|
exports.usePhysics = usePhysics;
|
|
42085
41473
|
exports.usePhysics2D = usePhysics2D;
|
|
42086
41474
|
exports.usePinchZoom = usePinchZoom;
|
|
@@ -42088,14 +41476,11 @@ exports.usePlayer = usePlayer;
|
|
|
42088
41476
|
exports.usePreview = usePreview;
|
|
42089
41477
|
exports.usePullToRefresh = usePullToRefresh;
|
|
42090
41478
|
exports.useQuerySingleton = useQuerySingleton;
|
|
42091
|
-
exports.useResolvedEntity = useResolvedEntity;
|
|
42092
41479
|
exports.useSelectedEntity = useSelectedEntity;
|
|
42093
|
-
exports.useSendOrbitalEvent = useSendOrbitalEvent;
|
|
42094
41480
|
exports.useSingletonEntity = useSingletonEntity;
|
|
42095
41481
|
exports.useSpriteAnimations = useSpriteAnimations;
|
|
42096
41482
|
exports.useSwipeGesture = useSwipeGesture;
|
|
42097
41483
|
exports.useTranslate = useTranslate;
|
|
42098
41484
|
exports.useUIEvents = useUIEvents;
|
|
42099
41485
|
exports.useUISlotManager = useUISlotManager;
|
|
42100
|
-
exports.useUpdateEntity = useUpdateEntity;
|
|
42101
41486
|
exports.useValidation = useValidation;
|