@almadar/ui 5.9.10 → 5.12.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 -82
- package/dist/avl/index.js +128 -82
- package/dist/components/index.cjs +128 -82
- package/dist/components/index.js +128 -82
- 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 +128 -82
- package/dist/providers/index.js +128 -82
- package/dist/runtime/index.cjs +128 -82
- package/dist/runtime/index.js +128 -82
- 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,
|
|
@@ -33008,10 +33031,13 @@ function TableView({
|
|
|
33008
33031
|
}
|
|
33009
33032
|
const lk = LOOKS[look];
|
|
33010
33033
|
const hasActions = Boolean(itemActions && itemActions.length > 0);
|
|
33034
|
+
const inlineActionCount = hasActions ? maxInlineActions != null ? Math.min(itemActions.length, maxInlineActions) : itemActions.length : 0;
|
|
33035
|
+
const hasOverflowActions = hasActions && maxInlineActions != null && itemActions.length > maxInlineActions;
|
|
33036
|
+
const actionsTrack = hasActions ? `${inlineActionCount * 6 + (hasOverflowActions ? 3 : 0)}rem` : null;
|
|
33011
33037
|
const gridTemplateColumns = [
|
|
33012
33038
|
selectable ? "auto" : null,
|
|
33013
33039
|
...colDefs.map((c) => c.width ?? "minmax(0, 1fr)"),
|
|
33014
|
-
|
|
33040
|
+
actionsTrack
|
|
33015
33041
|
].filter(Boolean).join(" ");
|
|
33016
33042
|
const header = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
33017
33043
|
Box,
|
|
@@ -33098,22 +33124,41 @@ function TableView({
|
|
|
33098
33124
|
}
|
|
33099
33125
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: formatCell(raw, col.format) }) }, col.key);
|
|
33100
33126
|
}),
|
|
33101
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.
|
|
33102
|
-
|
|
33103
|
-
|
|
33104
|
-
|
|
33105
|
-
|
|
33106
|
-
|
|
33107
|
-
|
|
33108
|
-
|
|
33109
|
-
|
|
33110
|
-
|
|
33111
|
-
|
|
33112
|
-
|
|
33113
|
-
|
|
33114
|
-
|
|
33115
|
-
|
|
33116
|
-
|
|
33127
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "justify-end flex-shrink-0 opacity-60 group-hover:opacity-100 transition-opacity", children: [
|
|
33128
|
+
(maxInlineActions != null ? itemActions.slice(0, maxInlineActions) : itemActions).map((action, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
33129
|
+
Button,
|
|
33130
|
+
{
|
|
33131
|
+
variant: action.variant ?? "ghost",
|
|
33132
|
+
size: "sm",
|
|
33133
|
+
onClick: handleActionClick(action, row),
|
|
33134
|
+
"data-testid": `action-${action.event}`,
|
|
33135
|
+
"data-row-id": String(row.id),
|
|
33136
|
+
className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
|
|
33137
|
+
children: [
|
|
33138
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
33139
|
+
action.label
|
|
33140
|
+
]
|
|
33141
|
+
},
|
|
33142
|
+
i
|
|
33143
|
+
)),
|
|
33144
|
+
maxInlineActions != null && itemActions.length > maxInlineActions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
33145
|
+
Menu,
|
|
33146
|
+
{
|
|
33147
|
+
position: "bottom-end",
|
|
33148
|
+
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" }) }),
|
|
33149
|
+
items: itemActions.slice(maxInlineActions).map((action) => ({
|
|
33150
|
+
label: action.label,
|
|
33151
|
+
icon: action.icon,
|
|
33152
|
+
event: action.event,
|
|
33153
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
33154
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
33155
|
+
id: row.id,
|
|
33156
|
+
row
|
|
33157
|
+
})
|
|
33158
|
+
}))
|
|
33159
|
+
}
|
|
33160
|
+
)
|
|
33161
|
+
] })
|
|
33117
33162
|
]
|
|
33118
33163
|
}
|
|
33119
33164
|
);
|
|
@@ -33161,6 +33206,7 @@ var init_TableView = __esm({
|
|
|
33161
33206
|
init_Icon();
|
|
33162
33207
|
init_Checkbox();
|
|
33163
33208
|
init_Divider();
|
|
33209
|
+
init_Menu();
|
|
33164
33210
|
init_useDataDnd();
|
|
33165
33211
|
logger.createLogger("almadar:ui:table-view");
|
|
33166
33212
|
alignClass = {
|
|
@@ -33174,11 +33220,11 @@ var init_TableView = __esm({
|
|
|
33174
33220
|
semibold: "font-semibold"
|
|
33175
33221
|
};
|
|
33176
33222
|
LOOKS = {
|
|
33177
|
-
dense: { rowPad: "px-
|
|
33178
|
-
spacious: { rowPad: "px-
|
|
33179
|
-
striped: { rowPad: "px-
|
|
33180
|
-
borderless: { rowPad: "px-
|
|
33181
|
-
bordered: { rowPad: "px-
|
|
33223
|
+
dense: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true },
|
|
33224
|
+
spacious: { rowPad: "px-card-lg py-card-md", headPad: "px-card-lg py-card-sm", striped: false, divider: true },
|
|
33225
|
+
striped: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: true, divider: false },
|
|
33226
|
+
borderless: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: false },
|
|
33227
|
+
bordered: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true }
|
|
33182
33228
|
};
|
|
33183
33229
|
TableView.displayName = "TableView";
|
|
33184
33230
|
}
|
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,
|
|
@@ -32959,10 +32982,13 @@ function TableView({
|
|
|
32959
32982
|
}
|
|
32960
32983
|
const lk = LOOKS[look];
|
|
32961
32984
|
const hasActions = Boolean(itemActions && itemActions.length > 0);
|
|
32985
|
+
const inlineActionCount = hasActions ? maxInlineActions != null ? Math.min(itemActions.length, maxInlineActions) : itemActions.length : 0;
|
|
32986
|
+
const hasOverflowActions = hasActions && maxInlineActions != null && itemActions.length > maxInlineActions;
|
|
32987
|
+
const actionsTrack = hasActions ? `${inlineActionCount * 6 + (hasOverflowActions ? 3 : 0)}rem` : null;
|
|
32962
32988
|
const gridTemplateColumns = [
|
|
32963
32989
|
selectable ? "auto" : null,
|
|
32964
32990
|
...colDefs.map((c) => c.width ?? "minmax(0, 1fr)"),
|
|
32965
|
-
|
|
32991
|
+
actionsTrack
|
|
32966
32992
|
].filter(Boolean).join(" ");
|
|
32967
32993
|
const header = /* @__PURE__ */ jsxs(
|
|
32968
32994
|
Box,
|
|
@@ -33049,22 +33075,41 @@ function TableView({
|
|
|
33049
33075
|
}
|
|
33050
33076
|
return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: formatCell(raw, col.format) }) }, col.key);
|
|
33051
33077
|
}),
|
|
33052
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */
|
|
33053
|
-
|
|
33054
|
-
|
|
33055
|
-
|
|
33056
|
-
|
|
33057
|
-
|
|
33058
|
-
|
|
33059
|
-
|
|
33060
|
-
|
|
33061
|
-
|
|
33062
|
-
|
|
33063
|
-
|
|
33064
|
-
|
|
33065
|
-
|
|
33066
|
-
|
|
33067
|
-
|
|
33078
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "justify-end flex-shrink-0 opacity-60 group-hover:opacity-100 transition-opacity", children: [
|
|
33079
|
+
(maxInlineActions != null ? itemActions.slice(0, maxInlineActions) : itemActions).map((action, i) => /* @__PURE__ */ jsxs(
|
|
33080
|
+
Button,
|
|
33081
|
+
{
|
|
33082
|
+
variant: action.variant ?? "ghost",
|
|
33083
|
+
size: "sm",
|
|
33084
|
+
onClick: handleActionClick(action, row),
|
|
33085
|
+
"data-testid": `action-${action.event}`,
|
|
33086
|
+
"data-row-id": String(row.id),
|
|
33087
|
+
className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
|
|
33088
|
+
children: [
|
|
33089
|
+
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
33090
|
+
action.label
|
|
33091
|
+
]
|
|
33092
|
+
},
|
|
33093
|
+
i
|
|
33094
|
+
)),
|
|
33095
|
+
maxInlineActions != null && itemActions.length > maxInlineActions && /* @__PURE__ */ jsx(
|
|
33096
|
+
Menu,
|
|
33097
|
+
{
|
|
33098
|
+
position: "bottom-end",
|
|
33099
|
+
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" }) }),
|
|
33100
|
+
items: itemActions.slice(maxInlineActions).map((action) => ({
|
|
33101
|
+
label: action.label,
|
|
33102
|
+
icon: action.icon,
|
|
33103
|
+
event: action.event,
|
|
33104
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
33105
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
33106
|
+
id: row.id,
|
|
33107
|
+
row
|
|
33108
|
+
})
|
|
33109
|
+
}))
|
|
33110
|
+
}
|
|
33111
|
+
)
|
|
33112
|
+
] })
|
|
33068
33113
|
]
|
|
33069
33114
|
}
|
|
33070
33115
|
);
|
|
@@ -33112,6 +33157,7 @@ var init_TableView = __esm({
|
|
|
33112
33157
|
init_Icon();
|
|
33113
33158
|
init_Checkbox();
|
|
33114
33159
|
init_Divider();
|
|
33160
|
+
init_Menu();
|
|
33115
33161
|
init_useDataDnd();
|
|
33116
33162
|
createLogger("almadar:ui:table-view");
|
|
33117
33163
|
alignClass = {
|
|
@@ -33125,11 +33171,11 @@ var init_TableView = __esm({
|
|
|
33125
33171
|
semibold: "font-semibold"
|
|
33126
33172
|
};
|
|
33127
33173
|
LOOKS = {
|
|
33128
|
-
dense: { rowPad: "px-
|
|
33129
|
-
spacious: { rowPad: "px-
|
|
33130
|
-
striped: { rowPad: "px-
|
|
33131
|
-
borderless: { rowPad: "px-
|
|
33132
|
-
bordered: { rowPad: "px-
|
|
33174
|
+
dense: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true },
|
|
33175
|
+
spacious: { rowPad: "px-card-lg py-card-md", headPad: "px-card-lg py-card-sm", striped: false, divider: true },
|
|
33176
|
+
striped: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: true, divider: false },
|
|
33177
|
+
borderless: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: false },
|
|
33178
|
+
bordered: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true }
|
|
33133
33179
|
};
|
|
33134
33180
|
TableView.displayName = "TableView";
|
|
33135
33181
|
}
|