@almadar/ui 5.9.9 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avl/index.cjs +128 -83
- package/dist/avl/index.js +128 -83
- package/dist/components/index.cjs +124 -81
- package/dist/components/index.js +124 -81
- package/dist/components/molecules/DataGrid.d.ts +5 -1
- package/dist/components/molecules/DataList.d.ts +3 -1
- package/dist/components/molecules/TableView.d.ts +3 -1
- package/dist/providers/index.cjs +124 -81
- package/dist/providers/index.js +124 -81
- package/dist/runtime/index.cjs +128 -83
- package/dist/runtime/index.js +128 -83
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -27036,6 +27036,8 @@ function DataGrid({
|
|
|
27036
27036
|
fields,
|
|
27037
27037
|
columns,
|
|
27038
27038
|
itemActions,
|
|
27039
|
+
maxInlineActions,
|
|
27040
|
+
scrollX = false,
|
|
27039
27041
|
cols,
|
|
27040
27042
|
gap = "md",
|
|
27041
27043
|
minCardWidth = 280,
|
|
@@ -27175,8 +27177,8 @@ function DataGrid({
|
|
|
27175
27177
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
27176
27178
|
Box,
|
|
27177
27179
|
{
|
|
27178
|
-
className: cn("grid", gapStyles6[gap], colsClass, lookStyles5[look], className),
|
|
27179
|
-
style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
|
|
27180
|
+
className: cn("grid", gapStyles6[gap], scrollX ? "grid-flow-col overflow-x-auto" : colsClass, lookStyles5[look], className),
|
|
27181
|
+
style: scrollX ? { gridAutoFlow: "column", gridAutoColumns: `minmax(${minCardWidth}px, 1fr)` } : gridTemplateColumns ? { gridTemplateColumns } : void 0,
|
|
27180
27182
|
children: data.map((item, index) => {
|
|
27181
27183
|
const itemData = item;
|
|
27182
27184
|
const id = itemData.id || String(index);
|
|
@@ -27303,21 +27305,39 @@ function DataGrid({
|
|
|
27303
27305
|
)
|
|
27304
27306
|
] }, field.name);
|
|
27305
27307
|
}) }) }),
|
|
27306
|
-
primaryActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsxRuntime.
|
|
27307
|
-
|
|
27308
|
-
|
|
27309
|
-
|
|
27310
|
-
|
|
27311
|
-
|
|
27312
|
-
|
|
27313
|
-
|
|
27314
|
-
|
|
27315
|
-
|
|
27316
|
-
|
|
27317
|
-
|
|
27318
|
-
|
|
27319
|
-
|
|
27320
|
-
|
|
27308
|
+
primaryActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "sm", className: "justify-end", children: [
|
|
27309
|
+
(maxInlineActions != null ? primaryActions.slice(0, maxInlineActions) : primaryActions).map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
27310
|
+
Button,
|
|
27311
|
+
{
|
|
27312
|
+
variant: action.variant === "primary" ? "primary" : "ghost",
|
|
27313
|
+
size: "sm",
|
|
27314
|
+
onClick: handleActionClick(action, itemData),
|
|
27315
|
+
"data-testid": `action-${action.event}`,
|
|
27316
|
+
"data-row-id": String(itemData.id),
|
|
27317
|
+
children: [
|
|
27318
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
27319
|
+
action.label
|
|
27320
|
+
]
|
|
27321
|
+
},
|
|
27322
|
+
idx
|
|
27323
|
+
)),
|
|
27324
|
+
maxInlineActions != null && primaryActions.length > maxInlineActions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
27325
|
+
Menu,
|
|
27326
|
+
{
|
|
27327
|
+
position: "bottom-end",
|
|
27328
|
+
trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "sm", "aria-label": "More actions", "data-testid": "action-overflow", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
|
|
27329
|
+
items: primaryActions.slice(maxInlineActions).map((action) => ({
|
|
27330
|
+
label: action.label,
|
|
27331
|
+
icon: action.icon,
|
|
27332
|
+
event: action.event,
|
|
27333
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
27334
|
+
id: itemData.id,
|
|
27335
|
+
row: itemData
|
|
27336
|
+
})
|
|
27337
|
+
}))
|
|
27338
|
+
}
|
|
27339
|
+
)
|
|
27340
|
+
] }) })
|
|
27321
27341
|
]
|
|
27322
27342
|
},
|
|
27323
27343
|
id
|
|
@@ -27367,6 +27387,7 @@ var init_DataGrid = __esm({
|
|
|
27367
27387
|
init_Button();
|
|
27368
27388
|
init_Icon();
|
|
27369
27389
|
init_InfiniteScrollSentinel();
|
|
27390
|
+
init_Menu();
|
|
27370
27391
|
init_useDataDnd();
|
|
27371
27392
|
dataGridLog = logger.createLogger("almadar:ui:data-grid");
|
|
27372
27393
|
BADGE_VARIANTS = /* @__PURE__ */ new Set([
|
|
@@ -27446,6 +27467,7 @@ function DataList({
|
|
|
27446
27467
|
fields,
|
|
27447
27468
|
columns,
|
|
27448
27469
|
itemActions,
|
|
27470
|
+
maxInlineActions,
|
|
27449
27471
|
itemClickEvent,
|
|
27450
27472
|
gap = "none",
|
|
27451
27473
|
variant = "default",
|
|
@@ -27536,6 +27558,46 @@ function DataList({
|
|
|
27536
27558
|
};
|
|
27537
27559
|
eventBus.emit(`UI:${action.event}`, payload);
|
|
27538
27560
|
};
|
|
27561
|
+
const renderItemActions = (itemData) => {
|
|
27562
|
+
if (!itemActions || itemActions.length === 0) return null;
|
|
27563
|
+
const inline = maxInlineActions != null ? itemActions.slice(0, maxInlineActions) : itemActions;
|
|
27564
|
+
const overflow = maxInlineActions != null ? itemActions.slice(maxInlineActions) : [];
|
|
27565
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "flex-shrink-0", children: [
|
|
27566
|
+
inline.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
27567
|
+
Button,
|
|
27568
|
+
{
|
|
27569
|
+
variant: action.variant ?? "ghost",
|
|
27570
|
+
size: "sm",
|
|
27571
|
+
onClick: handleActionClick(action, itemData),
|
|
27572
|
+
"data-testid": `action-${action.event}`,
|
|
27573
|
+
"data-row-id": String(itemData.id),
|
|
27574
|
+
className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
|
|
27575
|
+
children: [
|
|
27576
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
27577
|
+
action.label
|
|
27578
|
+
]
|
|
27579
|
+
},
|
|
27580
|
+
idx
|
|
27581
|
+
)),
|
|
27582
|
+
overflow.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
27583
|
+
Menu,
|
|
27584
|
+
{
|
|
27585
|
+
position: "bottom-end",
|
|
27586
|
+
trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "sm", "aria-label": "More actions", "data-testid": "action-overflow", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
|
|
27587
|
+
items: overflow.map((action) => ({
|
|
27588
|
+
label: action.label,
|
|
27589
|
+
icon: action.icon,
|
|
27590
|
+
event: action.event,
|
|
27591
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
27592
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
27593
|
+
id: itemData.id,
|
|
27594
|
+
row: itemData
|
|
27595
|
+
})
|
|
27596
|
+
}))
|
|
27597
|
+
}
|
|
27598
|
+
)
|
|
27599
|
+
] });
|
|
27600
|
+
};
|
|
27539
27601
|
const handleRowClick = (itemData) => () => {
|
|
27540
27602
|
if (!itemClickEvent) return;
|
|
27541
27603
|
const payload = {
|
|
@@ -27625,31 +27687,7 @@ function DataList({
|
|
|
27625
27687
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, onClick: itemClickEvent ? handleRowClick(itemData) : void 0, className: cn(itemClickEvent && "cursor-pointer"), children: [
|
|
27626
27688
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "group flex items-stretch gap-2", children: [
|
|
27627
27689
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
|
|
27628
|
-
|
|
27629
|
-
HStack,
|
|
27630
|
-
{
|
|
27631
|
-
gap: "xs",
|
|
27632
|
-
className: "flex-shrink-0",
|
|
27633
|
-
children: itemActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
27634
|
-
Button,
|
|
27635
|
-
{
|
|
27636
|
-
variant: action.variant ?? "ghost",
|
|
27637
|
-
size: "sm",
|
|
27638
|
-
onClick: handleActionClick(action, itemData),
|
|
27639
|
-
"data-testid": `action-${action.event}`,
|
|
27640
|
-
"data-row-id": String(itemData.id),
|
|
27641
|
-
className: cn(
|
|
27642
|
-
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
27643
|
-
),
|
|
27644
|
-
children: [
|
|
27645
|
-
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
27646
|
-
action.label
|
|
27647
|
-
]
|
|
27648
|
-
},
|
|
27649
|
-
idx
|
|
27650
|
-
))
|
|
27651
|
-
}
|
|
27652
|
-
)
|
|
27690
|
+
renderItemActions(itemData)
|
|
27653
27691
|
] }),
|
|
27654
27692
|
isCard && !isLast && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "mx-6 border-b border-border/40" })
|
|
27655
27693
|
] }, id2)
|
|
@@ -27720,24 +27758,7 @@ function DataList({
|
|
|
27720
27758
|
] }, field.name);
|
|
27721
27759
|
})
|
|
27722
27760
|
] }),
|
|
27723
|
-
|
|
27724
|
-
Button,
|
|
27725
|
-
{
|
|
27726
|
-
variant: action.variant ?? "ghost",
|
|
27727
|
-
size: "sm",
|
|
27728
|
-
onClick: handleActionClick(action, itemData),
|
|
27729
|
-
"data-testid": `action-${action.event}`,
|
|
27730
|
-
"data-row-id": String(itemData.id),
|
|
27731
|
-
className: cn(
|
|
27732
|
-
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
27733
|
-
),
|
|
27734
|
-
children: [
|
|
27735
|
-
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
27736
|
-
action.label
|
|
27737
|
-
]
|
|
27738
|
-
},
|
|
27739
|
-
idx
|
|
27740
|
-
)) })
|
|
27761
|
+
renderItemActions(itemData)
|
|
27741
27762
|
]
|
|
27742
27763
|
}
|
|
27743
27764
|
),
|
|
@@ -27807,6 +27828,7 @@ var init_DataList = __esm({
|
|
|
27807
27828
|
init_ProgressBar();
|
|
27808
27829
|
init_Divider();
|
|
27809
27830
|
init_InfiniteScrollSentinel();
|
|
27831
|
+
init_Menu();
|
|
27810
27832
|
init_useDataDnd();
|
|
27811
27833
|
dataListLog = logger.createLogger("almadar:ui:data-list");
|
|
27812
27834
|
listLookStyles = {
|
|
@@ -32916,6 +32938,7 @@ function TableView({
|
|
|
32916
32938
|
columns,
|
|
32917
32939
|
fields,
|
|
32918
32940
|
itemActions,
|
|
32941
|
+
maxInlineActions,
|
|
32919
32942
|
selectable = false,
|
|
32920
32943
|
selectEvent,
|
|
32921
32944
|
selectedIds,
|
|
@@ -33098,22 +33121,41 @@ function TableView({
|
|
|
33098
33121
|
}
|
|
33099
33122
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: formatCell(raw, col.format) }) }, col.key);
|
|
33100
33123
|
}),
|
|
33101
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.
|
|
33102
|
-
|
|
33103
|
-
|
|
33104
|
-
|
|
33105
|
-
|
|
33106
|
-
|
|
33107
|
-
|
|
33108
|
-
|
|
33109
|
-
|
|
33110
|
-
|
|
33111
|
-
|
|
33112
|
-
|
|
33113
|
-
|
|
33114
|
-
|
|
33115
|
-
|
|
33116
|
-
|
|
33124
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "flex-shrink-0 opacity-60 group-hover:opacity-100 transition-opacity", children: [
|
|
33125
|
+
(maxInlineActions != null ? itemActions.slice(0, maxInlineActions) : itemActions).map((action, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
33126
|
+
Button,
|
|
33127
|
+
{
|
|
33128
|
+
variant: action.variant ?? "ghost",
|
|
33129
|
+
size: "sm",
|
|
33130
|
+
onClick: handleActionClick(action, row),
|
|
33131
|
+
"data-testid": `action-${action.event}`,
|
|
33132
|
+
"data-row-id": String(row.id),
|
|
33133
|
+
className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
|
|
33134
|
+
children: [
|
|
33135
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
33136
|
+
action.label
|
|
33137
|
+
]
|
|
33138
|
+
},
|
|
33139
|
+
i
|
|
33140
|
+
)),
|
|
33141
|
+
maxInlineActions != null && itemActions.length > maxInlineActions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
33142
|
+
Menu,
|
|
33143
|
+
{
|
|
33144
|
+
position: "bottom-end",
|
|
33145
|
+
trigger: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "sm", "aria-label": "More actions", "data-testid": "action-overflow", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
|
|
33146
|
+
items: itemActions.slice(maxInlineActions).map((action) => ({
|
|
33147
|
+
label: action.label,
|
|
33148
|
+
icon: action.icon,
|
|
33149
|
+
event: action.event,
|
|
33150
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
33151
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
33152
|
+
id: row.id,
|
|
33153
|
+
row
|
|
33154
|
+
})
|
|
33155
|
+
}))
|
|
33156
|
+
}
|
|
33157
|
+
)
|
|
33158
|
+
] })
|
|
33117
33159
|
]
|
|
33118
33160
|
}
|
|
33119
33161
|
);
|
|
@@ -33161,6 +33203,7 @@ var init_TableView = __esm({
|
|
|
33161
33203
|
init_Icon();
|
|
33162
33204
|
init_Checkbox();
|
|
33163
33205
|
init_Divider();
|
|
33206
|
+
init_Menu();
|
|
33164
33207
|
init_useDataDnd();
|
|
33165
33208
|
logger.createLogger("almadar:ui:table-view");
|
|
33166
33209
|
alignClass = {
|
|
@@ -33174,11 +33217,11 @@ var init_TableView = __esm({
|
|
|
33174
33217
|
semibold: "font-semibold"
|
|
33175
33218
|
};
|
|
33176
33219
|
LOOKS = {
|
|
33177
|
-
dense: { rowPad: "px-
|
|
33178
|
-
spacious: { rowPad: "px-
|
|
33179
|
-
striped: { rowPad: "px-
|
|
33180
|
-
borderless: { rowPad: "px-
|
|
33181
|
-
bordered: { rowPad: "px-
|
|
33220
|
+
dense: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true },
|
|
33221
|
+
spacious: { rowPad: "px-card-lg py-card-md", headPad: "px-card-lg py-card-sm", striped: false, divider: true },
|
|
33222
|
+
striped: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: true, divider: false },
|
|
33223
|
+
borderless: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: false },
|
|
33224
|
+
bordered: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true }
|
|
33182
33225
|
};
|
|
33183
33226
|
TableView.displayName = "TableView";
|
|
33184
33227
|
}
|
|
@@ -61932,11 +61975,13 @@ function OrbPreview({
|
|
|
61932
61975
|
return match?.page.name;
|
|
61933
61976
|
}, [pages, initialPagePath]);
|
|
61934
61977
|
const [currentPage, setCurrentPage] = React98.useState(initialPageName);
|
|
61978
|
+
const prevInitialPagePathRef = React98.useRef(initialPagePath);
|
|
61935
61979
|
React98.useEffect(() => {
|
|
61936
|
-
if (
|
|
61980
|
+
if (prevInitialPagePathRef.current !== initialPagePath) {
|
|
61981
|
+
prevInitialPagePathRef.current = initialPagePath;
|
|
61937
61982
|
setCurrentPage(initialPageName);
|
|
61938
61983
|
}
|
|
61939
|
-
}, [
|
|
61984
|
+
}, [initialPagePath, initialPageName]);
|
|
61940
61985
|
const handleNavigate = React98.useCallback((path) => {
|
|
61941
61986
|
const match = pages.find(({ page }) => page.path === path);
|
|
61942
61987
|
navLog.debug("handleNavigate", () => ({
|
package/dist/avl/index.js
CHANGED
|
@@ -26987,6 +26987,8 @@ function DataGrid({
|
|
|
26987
26987
|
fields,
|
|
26988
26988
|
columns,
|
|
26989
26989
|
itemActions,
|
|
26990
|
+
maxInlineActions,
|
|
26991
|
+
scrollX = false,
|
|
26990
26992
|
cols,
|
|
26991
26993
|
gap = "md",
|
|
26992
26994
|
minCardWidth = 280,
|
|
@@ -27126,8 +27128,8 @@ function DataGrid({
|
|
|
27126
27128
|
/* @__PURE__ */ jsx(
|
|
27127
27129
|
Box,
|
|
27128
27130
|
{
|
|
27129
|
-
className: cn("grid", gapStyles6[gap], colsClass, lookStyles5[look], className),
|
|
27130
|
-
style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
|
|
27131
|
+
className: cn("grid", gapStyles6[gap], scrollX ? "grid-flow-col overflow-x-auto" : colsClass, lookStyles5[look], className),
|
|
27132
|
+
style: scrollX ? { gridAutoFlow: "column", gridAutoColumns: `minmax(${minCardWidth}px, 1fr)` } : gridTemplateColumns ? { gridTemplateColumns } : void 0,
|
|
27131
27133
|
children: data.map((item, index) => {
|
|
27132
27134
|
const itemData = item;
|
|
27133
27135
|
const id = itemData.id || String(index);
|
|
@@ -27254,21 +27256,39 @@ function DataGrid({
|
|
|
27254
27256
|
)
|
|
27255
27257
|
] }, field.name);
|
|
27256
27258
|
}) }) }),
|
|
27257
|
-
primaryActions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */
|
|
27258
|
-
|
|
27259
|
-
|
|
27260
|
-
|
|
27261
|
-
|
|
27262
|
-
|
|
27263
|
-
|
|
27264
|
-
|
|
27265
|
-
|
|
27266
|
-
|
|
27267
|
-
|
|
27268
|
-
|
|
27269
|
-
|
|
27270
|
-
|
|
27271
|
-
|
|
27259
|
+
primaryActions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "justify-end", children: [
|
|
27260
|
+
(maxInlineActions != null ? primaryActions.slice(0, maxInlineActions) : primaryActions).map((action, idx) => /* @__PURE__ */ jsxs(
|
|
27261
|
+
Button,
|
|
27262
|
+
{
|
|
27263
|
+
variant: action.variant === "primary" ? "primary" : "ghost",
|
|
27264
|
+
size: "sm",
|
|
27265
|
+
onClick: handleActionClick(action, itemData),
|
|
27266
|
+
"data-testid": `action-${action.event}`,
|
|
27267
|
+
"data-row-id": String(itemData.id),
|
|
27268
|
+
children: [
|
|
27269
|
+
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
27270
|
+
action.label
|
|
27271
|
+
]
|
|
27272
|
+
},
|
|
27273
|
+
idx
|
|
27274
|
+
)),
|
|
27275
|
+
maxInlineActions != null && primaryActions.length > maxInlineActions && /* @__PURE__ */ jsx(
|
|
27276
|
+
Menu,
|
|
27277
|
+
{
|
|
27278
|
+
position: "bottom-end",
|
|
27279
|
+
trigger: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-label": "More actions", "data-testid": "action-overflow", children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
|
|
27280
|
+
items: primaryActions.slice(maxInlineActions).map((action) => ({
|
|
27281
|
+
label: action.label,
|
|
27282
|
+
icon: action.icon,
|
|
27283
|
+
event: action.event,
|
|
27284
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
27285
|
+
id: itemData.id,
|
|
27286
|
+
row: itemData
|
|
27287
|
+
})
|
|
27288
|
+
}))
|
|
27289
|
+
}
|
|
27290
|
+
)
|
|
27291
|
+
] }) })
|
|
27272
27292
|
]
|
|
27273
27293
|
},
|
|
27274
27294
|
id
|
|
@@ -27318,6 +27338,7 @@ var init_DataGrid = __esm({
|
|
|
27318
27338
|
init_Button();
|
|
27319
27339
|
init_Icon();
|
|
27320
27340
|
init_InfiniteScrollSentinel();
|
|
27341
|
+
init_Menu();
|
|
27321
27342
|
init_useDataDnd();
|
|
27322
27343
|
dataGridLog = createLogger("almadar:ui:data-grid");
|
|
27323
27344
|
BADGE_VARIANTS = /* @__PURE__ */ new Set([
|
|
@@ -27397,6 +27418,7 @@ function DataList({
|
|
|
27397
27418
|
fields,
|
|
27398
27419
|
columns,
|
|
27399
27420
|
itemActions,
|
|
27421
|
+
maxInlineActions,
|
|
27400
27422
|
itemClickEvent,
|
|
27401
27423
|
gap = "none",
|
|
27402
27424
|
variant = "default",
|
|
@@ -27487,6 +27509,46 @@ function DataList({
|
|
|
27487
27509
|
};
|
|
27488
27510
|
eventBus.emit(`UI:${action.event}`, payload);
|
|
27489
27511
|
};
|
|
27512
|
+
const renderItemActions = (itemData) => {
|
|
27513
|
+
if (!itemActions || itemActions.length === 0) return null;
|
|
27514
|
+
const inline = maxInlineActions != null ? itemActions.slice(0, maxInlineActions) : itemActions;
|
|
27515
|
+
const overflow = maxInlineActions != null ? itemActions.slice(maxInlineActions) : [];
|
|
27516
|
+
return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "flex-shrink-0", children: [
|
|
27517
|
+
inline.map((action, idx) => /* @__PURE__ */ jsxs(
|
|
27518
|
+
Button,
|
|
27519
|
+
{
|
|
27520
|
+
variant: action.variant ?? "ghost",
|
|
27521
|
+
size: "sm",
|
|
27522
|
+
onClick: handleActionClick(action, itemData),
|
|
27523
|
+
"data-testid": `action-${action.event}`,
|
|
27524
|
+
"data-row-id": String(itemData.id),
|
|
27525
|
+
className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
|
|
27526
|
+
children: [
|
|
27527
|
+
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
27528
|
+
action.label
|
|
27529
|
+
]
|
|
27530
|
+
},
|
|
27531
|
+
idx
|
|
27532
|
+
)),
|
|
27533
|
+
overflow.length > 0 && /* @__PURE__ */ jsx(
|
|
27534
|
+
Menu,
|
|
27535
|
+
{
|
|
27536
|
+
position: "bottom-end",
|
|
27537
|
+
trigger: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-label": "More actions", "data-testid": "action-overflow", children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
|
|
27538
|
+
items: overflow.map((action) => ({
|
|
27539
|
+
label: action.label,
|
|
27540
|
+
icon: action.icon,
|
|
27541
|
+
event: action.event,
|
|
27542
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
27543
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
27544
|
+
id: itemData.id,
|
|
27545
|
+
row: itemData
|
|
27546
|
+
})
|
|
27547
|
+
}))
|
|
27548
|
+
}
|
|
27549
|
+
)
|
|
27550
|
+
] });
|
|
27551
|
+
};
|
|
27490
27552
|
const handleRowClick = (itemData) => () => {
|
|
27491
27553
|
if (!itemClickEvent) return;
|
|
27492
27554
|
const payload = {
|
|
@@ -27576,31 +27638,7 @@ function DataList({
|
|
|
27576
27638
|
/* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, onClick: itemClickEvent ? handleRowClick(itemData) : void 0, className: cn(itemClickEvent && "cursor-pointer"), children: [
|
|
27577
27639
|
/* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
|
|
27578
27640
|
/* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
|
|
27579
|
-
|
|
27580
|
-
HStack,
|
|
27581
|
-
{
|
|
27582
|
-
gap: "xs",
|
|
27583
|
-
className: "flex-shrink-0",
|
|
27584
|
-
children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
|
|
27585
|
-
Button,
|
|
27586
|
-
{
|
|
27587
|
-
variant: action.variant ?? "ghost",
|
|
27588
|
-
size: "sm",
|
|
27589
|
-
onClick: handleActionClick(action, itemData),
|
|
27590
|
-
"data-testid": `action-${action.event}`,
|
|
27591
|
-
"data-row-id": String(itemData.id),
|
|
27592
|
-
className: cn(
|
|
27593
|
-
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
27594
|
-
),
|
|
27595
|
-
children: [
|
|
27596
|
-
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
27597
|
-
action.label
|
|
27598
|
-
]
|
|
27599
|
-
},
|
|
27600
|
-
idx
|
|
27601
|
-
))
|
|
27602
|
-
}
|
|
27603
|
-
)
|
|
27641
|
+
renderItemActions(itemData)
|
|
27604
27642
|
] }),
|
|
27605
27643
|
isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
|
|
27606
27644
|
] }, id2)
|
|
@@ -27671,24 +27709,7 @@ function DataList({
|
|
|
27671
27709
|
] }, field.name);
|
|
27672
27710
|
})
|
|
27673
27711
|
] }),
|
|
27674
|
-
|
|
27675
|
-
Button,
|
|
27676
|
-
{
|
|
27677
|
-
variant: action.variant ?? "ghost",
|
|
27678
|
-
size: "sm",
|
|
27679
|
-
onClick: handleActionClick(action, itemData),
|
|
27680
|
-
"data-testid": `action-${action.event}`,
|
|
27681
|
-
"data-row-id": String(itemData.id),
|
|
27682
|
-
className: cn(
|
|
27683
|
-
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
27684
|
-
),
|
|
27685
|
-
children: [
|
|
27686
|
-
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
27687
|
-
action.label
|
|
27688
|
-
]
|
|
27689
|
-
},
|
|
27690
|
-
idx
|
|
27691
|
-
)) })
|
|
27712
|
+
renderItemActions(itemData)
|
|
27692
27713
|
]
|
|
27693
27714
|
}
|
|
27694
27715
|
),
|
|
@@ -27758,6 +27779,7 @@ var init_DataList = __esm({
|
|
|
27758
27779
|
init_ProgressBar();
|
|
27759
27780
|
init_Divider();
|
|
27760
27781
|
init_InfiniteScrollSentinel();
|
|
27782
|
+
init_Menu();
|
|
27761
27783
|
init_useDataDnd();
|
|
27762
27784
|
dataListLog = createLogger("almadar:ui:data-list");
|
|
27763
27785
|
listLookStyles = {
|
|
@@ -32867,6 +32889,7 @@ function TableView({
|
|
|
32867
32889
|
columns,
|
|
32868
32890
|
fields,
|
|
32869
32891
|
itemActions,
|
|
32892
|
+
maxInlineActions,
|
|
32870
32893
|
selectable = false,
|
|
32871
32894
|
selectEvent,
|
|
32872
32895
|
selectedIds,
|
|
@@ -33049,22 +33072,41 @@ function TableView({
|
|
|
33049
33072
|
}
|
|
33050
33073
|
return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: formatCell(raw, col.format) }) }, col.key);
|
|
33051
33074
|
}),
|
|
33052
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */
|
|
33053
|
-
|
|
33054
|
-
|
|
33055
|
-
|
|
33056
|
-
|
|
33057
|
-
|
|
33058
|
-
|
|
33059
|
-
|
|
33060
|
-
|
|
33061
|
-
|
|
33062
|
-
|
|
33063
|
-
|
|
33064
|
-
|
|
33065
|
-
|
|
33066
|
-
|
|
33067
|
-
|
|
33075
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "flex-shrink-0 opacity-60 group-hover:opacity-100 transition-opacity", children: [
|
|
33076
|
+
(maxInlineActions != null ? itemActions.slice(0, maxInlineActions) : itemActions).map((action, i) => /* @__PURE__ */ jsxs(
|
|
33077
|
+
Button,
|
|
33078
|
+
{
|
|
33079
|
+
variant: action.variant ?? "ghost",
|
|
33080
|
+
size: "sm",
|
|
33081
|
+
onClick: handleActionClick(action, row),
|
|
33082
|
+
"data-testid": `action-${action.event}`,
|
|
33083
|
+
"data-row-id": String(row.id),
|
|
33084
|
+
className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
|
|
33085
|
+
children: [
|
|
33086
|
+
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
33087
|
+
action.label
|
|
33088
|
+
]
|
|
33089
|
+
},
|
|
33090
|
+
i
|
|
33091
|
+
)),
|
|
33092
|
+
maxInlineActions != null && itemActions.length > maxInlineActions && /* @__PURE__ */ jsx(
|
|
33093
|
+
Menu,
|
|
33094
|
+
{
|
|
33095
|
+
position: "bottom-end",
|
|
33096
|
+
trigger: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-label": "More actions", "data-testid": "action-overflow", children: /* @__PURE__ */ jsx(Icon, { name: "more-horizontal", size: "xs" }) }),
|
|
33097
|
+
items: itemActions.slice(maxInlineActions).map((action) => ({
|
|
33098
|
+
label: action.label,
|
|
33099
|
+
icon: action.icon,
|
|
33100
|
+
event: action.event,
|
|
33101
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
33102
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
33103
|
+
id: row.id,
|
|
33104
|
+
row
|
|
33105
|
+
})
|
|
33106
|
+
}))
|
|
33107
|
+
}
|
|
33108
|
+
)
|
|
33109
|
+
] })
|
|
33068
33110
|
]
|
|
33069
33111
|
}
|
|
33070
33112
|
);
|
|
@@ -33112,6 +33154,7 @@ var init_TableView = __esm({
|
|
|
33112
33154
|
init_Icon();
|
|
33113
33155
|
init_Checkbox();
|
|
33114
33156
|
init_Divider();
|
|
33157
|
+
init_Menu();
|
|
33115
33158
|
init_useDataDnd();
|
|
33116
33159
|
createLogger("almadar:ui:table-view");
|
|
33117
33160
|
alignClass = {
|
|
@@ -33125,11 +33168,11 @@ var init_TableView = __esm({
|
|
|
33125
33168
|
semibold: "font-semibold"
|
|
33126
33169
|
};
|
|
33127
33170
|
LOOKS = {
|
|
33128
|
-
dense: { rowPad: "px-
|
|
33129
|
-
spacious: { rowPad: "px-
|
|
33130
|
-
striped: { rowPad: "px-
|
|
33131
|
-
borderless: { rowPad: "px-
|
|
33132
|
-
bordered: { rowPad: "px-
|
|
33171
|
+
dense: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true },
|
|
33172
|
+
spacious: { rowPad: "px-card-lg py-card-md", headPad: "px-card-lg py-card-sm", striped: false, divider: true },
|
|
33173
|
+
striped: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: true, divider: false },
|
|
33174
|
+
borderless: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: false },
|
|
33175
|
+
bordered: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true }
|
|
33133
33176
|
};
|
|
33134
33177
|
TableView.displayName = "TableView";
|
|
33135
33178
|
}
|
|
@@ -61883,11 +61926,13 @@ function OrbPreview({
|
|
|
61883
61926
|
return match?.page.name;
|
|
61884
61927
|
}, [pages, initialPagePath]);
|
|
61885
61928
|
const [currentPage, setCurrentPage] = useState(initialPageName);
|
|
61929
|
+
const prevInitialPagePathRef = useRef(initialPagePath);
|
|
61886
61930
|
useEffect(() => {
|
|
61887
|
-
if (
|
|
61931
|
+
if (prevInitialPagePathRef.current !== initialPagePath) {
|
|
61932
|
+
prevInitialPagePathRef.current = initialPagePath;
|
|
61888
61933
|
setCurrentPage(initialPageName);
|
|
61889
61934
|
}
|
|
61890
|
-
}, [
|
|
61935
|
+
}, [initialPagePath, initialPageName]);
|
|
61891
61936
|
const handleNavigate = useCallback((path) => {
|
|
61892
61937
|
const match = pages.find(({ page }) => page.path === path);
|
|
61893
61938
|
navLog.debug("handleNavigate", () => ({
|