@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/runtime/index.cjs
CHANGED
|
@@ -23217,6 +23217,8 @@ function DataGrid({
|
|
|
23217
23217
|
fields,
|
|
23218
23218
|
columns,
|
|
23219
23219
|
itemActions,
|
|
23220
|
+
maxInlineActions,
|
|
23221
|
+
scrollX = false,
|
|
23220
23222
|
cols,
|
|
23221
23223
|
gap = "md",
|
|
23222
23224
|
minCardWidth = 280,
|
|
@@ -23356,8 +23358,8 @@ function DataGrid({
|
|
|
23356
23358
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
23357
23359
|
Box,
|
|
23358
23360
|
{
|
|
23359
|
-
className: cn("grid", gapStyles6[gap], colsClass, lookStyles5[look], className),
|
|
23360
|
-
style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
|
|
23361
|
+
className: cn("grid", gapStyles6[gap], scrollX ? "grid-flow-col overflow-x-auto" : colsClass, lookStyles5[look], className),
|
|
23362
|
+
style: scrollX ? { gridAutoFlow: "column", gridAutoColumns: `minmax(${minCardWidth}px, 1fr)` } : gridTemplateColumns ? { gridTemplateColumns } : void 0,
|
|
23361
23363
|
children: data.map((item, index) => {
|
|
23362
23364
|
const itemData = item;
|
|
23363
23365
|
const id = itemData.id || String(index);
|
|
@@ -23484,21 +23486,39 @@ function DataGrid({
|
|
|
23484
23486
|
)
|
|
23485
23487
|
] }, field.name);
|
|
23486
23488
|
}) }) }),
|
|
23487
|
-
primaryActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */ jsxRuntime.
|
|
23488
|
-
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
23495
|
-
|
|
23496
|
-
|
|
23497
|
-
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
|
|
23501
|
-
|
|
23489
|
+
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: [
|
|
23490
|
+
(maxInlineActions != null ? primaryActions.slice(0, maxInlineActions) : primaryActions).map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
23491
|
+
Button,
|
|
23492
|
+
{
|
|
23493
|
+
variant: action.variant === "primary" ? "primary" : "ghost",
|
|
23494
|
+
size: "sm",
|
|
23495
|
+
onClick: handleActionClick(action, itemData),
|
|
23496
|
+
"data-testid": `action-${action.event}`,
|
|
23497
|
+
"data-row-id": String(itemData.id),
|
|
23498
|
+
children: [
|
|
23499
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
23500
|
+
action.label
|
|
23501
|
+
]
|
|
23502
|
+
},
|
|
23503
|
+
idx
|
|
23504
|
+
)),
|
|
23505
|
+
maxInlineActions != null && primaryActions.length > maxInlineActions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
23506
|
+
Menu,
|
|
23507
|
+
{
|
|
23508
|
+
position: "bottom-end",
|
|
23509
|
+
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" }) }),
|
|
23510
|
+
items: primaryActions.slice(maxInlineActions).map((action) => ({
|
|
23511
|
+
label: action.label,
|
|
23512
|
+
icon: action.icon,
|
|
23513
|
+
event: action.event,
|
|
23514
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
23515
|
+
id: itemData.id,
|
|
23516
|
+
row: itemData
|
|
23517
|
+
})
|
|
23518
|
+
}))
|
|
23519
|
+
}
|
|
23520
|
+
)
|
|
23521
|
+
] }) })
|
|
23502
23522
|
]
|
|
23503
23523
|
},
|
|
23504
23524
|
id
|
|
@@ -23548,6 +23568,7 @@ var init_DataGrid = __esm({
|
|
|
23548
23568
|
init_Button();
|
|
23549
23569
|
init_Icon();
|
|
23550
23570
|
init_InfiniteScrollSentinel();
|
|
23571
|
+
init_Menu();
|
|
23551
23572
|
init_useDataDnd();
|
|
23552
23573
|
dataGridLog = logger.createLogger("almadar:ui:data-grid");
|
|
23553
23574
|
BADGE_VARIANTS = /* @__PURE__ */ new Set([
|
|
@@ -23627,6 +23648,7 @@ function DataList({
|
|
|
23627
23648
|
fields,
|
|
23628
23649
|
columns,
|
|
23629
23650
|
itemActions,
|
|
23651
|
+
maxInlineActions,
|
|
23630
23652
|
itemClickEvent,
|
|
23631
23653
|
gap = "none",
|
|
23632
23654
|
variant = "default",
|
|
@@ -23717,6 +23739,46 @@ function DataList({
|
|
|
23717
23739
|
};
|
|
23718
23740
|
eventBus.emit(`UI:${action.event}`, payload);
|
|
23719
23741
|
};
|
|
23742
|
+
const renderItemActions = (itemData) => {
|
|
23743
|
+
if (!itemActions || itemActions.length === 0) return null;
|
|
23744
|
+
const inline = maxInlineActions != null ? itemActions.slice(0, maxInlineActions) : itemActions;
|
|
23745
|
+
const overflow = maxInlineActions != null ? itemActions.slice(maxInlineActions) : [];
|
|
23746
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "flex-shrink-0", children: [
|
|
23747
|
+
inline.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
23748
|
+
Button,
|
|
23749
|
+
{
|
|
23750
|
+
variant: action.variant ?? "ghost",
|
|
23751
|
+
size: "sm",
|
|
23752
|
+
onClick: handleActionClick(action, itemData),
|
|
23753
|
+
"data-testid": `action-${action.event}`,
|
|
23754
|
+
"data-row-id": String(itemData.id),
|
|
23755
|
+
className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
|
|
23756
|
+
children: [
|
|
23757
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
23758
|
+
action.label
|
|
23759
|
+
]
|
|
23760
|
+
},
|
|
23761
|
+
idx
|
|
23762
|
+
)),
|
|
23763
|
+
overflow.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
23764
|
+
Menu,
|
|
23765
|
+
{
|
|
23766
|
+
position: "bottom-end",
|
|
23767
|
+
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" }) }),
|
|
23768
|
+
items: overflow.map((action) => ({
|
|
23769
|
+
label: action.label,
|
|
23770
|
+
icon: action.icon,
|
|
23771
|
+
event: action.event,
|
|
23772
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
23773
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
23774
|
+
id: itemData.id,
|
|
23775
|
+
row: itemData
|
|
23776
|
+
})
|
|
23777
|
+
}))
|
|
23778
|
+
}
|
|
23779
|
+
)
|
|
23780
|
+
] });
|
|
23781
|
+
};
|
|
23720
23782
|
const handleRowClick = (itemData) => () => {
|
|
23721
23783
|
if (!itemClickEvent) return;
|
|
23722
23784
|
const payload = {
|
|
@@ -23806,31 +23868,7 @@ function DataList({
|
|
|
23806
23868
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, onClick: itemClickEvent ? handleRowClick(itemData) : void 0, className: cn(itemClickEvent && "cursor-pointer"), children: [
|
|
23807
23869
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "group flex items-stretch gap-2", children: [
|
|
23808
23870
|
/* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
|
|
23809
|
-
|
|
23810
|
-
HStack,
|
|
23811
|
-
{
|
|
23812
|
-
gap: "xs",
|
|
23813
|
-
className: "flex-shrink-0",
|
|
23814
|
-
children: itemActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
23815
|
-
Button,
|
|
23816
|
-
{
|
|
23817
|
-
variant: action.variant ?? "ghost",
|
|
23818
|
-
size: "sm",
|
|
23819
|
-
onClick: handleActionClick(action, itemData),
|
|
23820
|
-
"data-testid": `action-${action.event}`,
|
|
23821
|
-
"data-row-id": String(itemData.id),
|
|
23822
|
-
className: cn(
|
|
23823
|
-
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
23824
|
-
),
|
|
23825
|
-
children: [
|
|
23826
|
-
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
23827
|
-
action.label
|
|
23828
|
-
]
|
|
23829
|
-
},
|
|
23830
|
-
idx
|
|
23831
|
-
))
|
|
23832
|
-
}
|
|
23833
|
-
)
|
|
23871
|
+
renderItemActions(itemData)
|
|
23834
23872
|
] }),
|
|
23835
23873
|
isCard && !isLast && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "mx-6 border-b border-border/40" })
|
|
23836
23874
|
] }, id2)
|
|
@@ -23901,24 +23939,7 @@ function DataList({
|
|
|
23901
23939
|
] }, field.name);
|
|
23902
23940
|
})
|
|
23903
23941
|
] }),
|
|
23904
|
-
|
|
23905
|
-
Button,
|
|
23906
|
-
{
|
|
23907
|
-
variant: action.variant ?? "ghost",
|
|
23908
|
-
size: "sm",
|
|
23909
|
-
onClick: handleActionClick(action, itemData),
|
|
23910
|
-
"data-testid": `action-${action.event}`,
|
|
23911
|
-
"data-row-id": String(itemData.id),
|
|
23912
|
-
className: cn(
|
|
23913
|
-
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
23914
|
-
),
|
|
23915
|
-
children: [
|
|
23916
|
-
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
23917
|
-
action.label
|
|
23918
|
-
]
|
|
23919
|
-
},
|
|
23920
|
-
idx
|
|
23921
|
-
)) })
|
|
23942
|
+
renderItemActions(itemData)
|
|
23922
23943
|
]
|
|
23923
23944
|
}
|
|
23924
23945
|
),
|
|
@@ -23988,6 +24009,7 @@ var init_DataList = __esm({
|
|
|
23988
24009
|
init_ProgressBar();
|
|
23989
24010
|
init_Divider();
|
|
23990
24011
|
init_InfiniteScrollSentinel();
|
|
24012
|
+
init_Menu();
|
|
23991
24013
|
init_useDataDnd();
|
|
23992
24014
|
dataListLog = logger.createLogger("almadar:ui:data-list");
|
|
23993
24015
|
listLookStyles = {
|
|
@@ -29033,6 +29055,7 @@ function TableView({
|
|
|
29033
29055
|
columns,
|
|
29034
29056
|
fields,
|
|
29035
29057
|
itemActions,
|
|
29058
|
+
maxInlineActions,
|
|
29036
29059
|
selectable = false,
|
|
29037
29060
|
selectEvent,
|
|
29038
29061
|
selectedIds,
|
|
@@ -29215,22 +29238,41 @@ function TableView({
|
|
|
29215
29238
|
}
|
|
29216
29239
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: formatCell(raw, col.format) }) }, col.key);
|
|
29217
29240
|
}),
|
|
29218
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.
|
|
29219
|
-
|
|
29220
|
-
|
|
29221
|
-
|
|
29222
|
-
|
|
29223
|
-
|
|
29224
|
-
|
|
29225
|
-
|
|
29226
|
-
|
|
29227
|
-
|
|
29228
|
-
|
|
29229
|
-
|
|
29230
|
-
|
|
29231
|
-
|
|
29232
|
-
|
|
29233
|
-
|
|
29241
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "flex-shrink-0 opacity-60 group-hover:opacity-100 transition-opacity", children: [
|
|
29242
|
+
(maxInlineActions != null ? itemActions.slice(0, maxInlineActions) : itemActions).map((action, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29243
|
+
Button,
|
|
29244
|
+
{
|
|
29245
|
+
variant: action.variant ?? "ghost",
|
|
29246
|
+
size: "sm",
|
|
29247
|
+
onClick: handleActionClick(action, row),
|
|
29248
|
+
"data-testid": `action-${action.event}`,
|
|
29249
|
+
"data-row-id": String(row.id),
|
|
29250
|
+
className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
|
|
29251
|
+
children: [
|
|
29252
|
+
action.icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
29253
|
+
action.label
|
|
29254
|
+
]
|
|
29255
|
+
},
|
|
29256
|
+
i
|
|
29257
|
+
)),
|
|
29258
|
+
maxInlineActions != null && itemActions.length > maxInlineActions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
29259
|
+
Menu,
|
|
29260
|
+
{
|
|
29261
|
+
position: "bottom-end",
|
|
29262
|
+
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" }) }),
|
|
29263
|
+
items: itemActions.slice(maxInlineActions).map((action) => ({
|
|
29264
|
+
label: action.label,
|
|
29265
|
+
icon: action.icon,
|
|
29266
|
+
event: action.event,
|
|
29267
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
29268
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
29269
|
+
id: row.id,
|
|
29270
|
+
row
|
|
29271
|
+
})
|
|
29272
|
+
}))
|
|
29273
|
+
}
|
|
29274
|
+
)
|
|
29275
|
+
] })
|
|
29234
29276
|
]
|
|
29235
29277
|
}
|
|
29236
29278
|
);
|
|
@@ -29278,6 +29320,7 @@ var init_TableView = __esm({
|
|
|
29278
29320
|
init_Icon();
|
|
29279
29321
|
init_Checkbox();
|
|
29280
29322
|
init_Divider();
|
|
29323
|
+
init_Menu();
|
|
29281
29324
|
init_useDataDnd();
|
|
29282
29325
|
logger.createLogger("almadar:ui:table-view");
|
|
29283
29326
|
alignClass = {
|
|
@@ -29291,11 +29334,11 @@ var init_TableView = __esm({
|
|
|
29291
29334
|
semibold: "font-semibold"
|
|
29292
29335
|
};
|
|
29293
29336
|
LOOKS = {
|
|
29294
|
-
dense: { rowPad: "px-
|
|
29295
|
-
spacious: { rowPad: "px-
|
|
29296
|
-
striped: { rowPad: "px-
|
|
29297
|
-
borderless: { rowPad: "px-
|
|
29298
|
-
bordered: { rowPad: "px-
|
|
29337
|
+
dense: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true },
|
|
29338
|
+
spacious: { rowPad: "px-card-lg py-card-md", headPad: "px-card-lg py-card-sm", striped: false, divider: true },
|
|
29339
|
+
striped: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: true, divider: false },
|
|
29340
|
+
borderless: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: false },
|
|
29341
|
+
bordered: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true }
|
|
29299
29342
|
};
|
|
29300
29343
|
TableView.displayName = "TableView";
|
|
29301
29344
|
}
|
|
@@ -49611,11 +49654,13 @@ function OrbPreview({
|
|
|
49611
49654
|
return match?.page.name;
|
|
49612
49655
|
}, [pages, initialPagePath]);
|
|
49613
49656
|
const [currentPage, setCurrentPage] = React85.useState(initialPageName);
|
|
49657
|
+
const prevInitialPagePathRef = React85.useRef(initialPagePath);
|
|
49614
49658
|
React85.useEffect(() => {
|
|
49615
|
-
if (
|
|
49659
|
+
if (prevInitialPagePathRef.current !== initialPagePath) {
|
|
49660
|
+
prevInitialPagePathRef.current = initialPagePath;
|
|
49616
49661
|
setCurrentPage(initialPageName);
|
|
49617
49662
|
}
|
|
49618
|
-
}, [
|
|
49663
|
+
}, [initialPagePath, initialPageName]);
|
|
49619
49664
|
const handleNavigate = React85.useCallback((path) => {
|
|
49620
49665
|
const match = pages.find(({ page }) => page.path === path);
|
|
49621
49666
|
navLog.debug("handleNavigate", () => ({
|
package/dist/runtime/index.js
CHANGED
|
@@ -23168,6 +23168,8 @@ function DataGrid({
|
|
|
23168
23168
|
fields,
|
|
23169
23169
|
columns,
|
|
23170
23170
|
itemActions,
|
|
23171
|
+
maxInlineActions,
|
|
23172
|
+
scrollX = false,
|
|
23171
23173
|
cols,
|
|
23172
23174
|
gap = "md",
|
|
23173
23175
|
minCardWidth = 280,
|
|
@@ -23307,8 +23309,8 @@ function DataGrid({
|
|
|
23307
23309
|
/* @__PURE__ */ jsx(
|
|
23308
23310
|
Box,
|
|
23309
23311
|
{
|
|
23310
|
-
className: cn("grid", gapStyles6[gap], colsClass, lookStyles5[look], className),
|
|
23311
|
-
style: gridTemplateColumns ? { gridTemplateColumns } : void 0,
|
|
23312
|
+
className: cn("grid", gapStyles6[gap], scrollX ? "grid-flow-col overflow-x-auto" : colsClass, lookStyles5[look], className),
|
|
23313
|
+
style: scrollX ? { gridAutoFlow: "column", gridAutoColumns: `minmax(${minCardWidth}px, 1fr)` } : gridTemplateColumns ? { gridTemplateColumns } : void 0,
|
|
23312
23314
|
children: data.map((item, index) => {
|
|
23313
23315
|
const itemData = item;
|
|
23314
23316
|
const id = itemData.id || String(index);
|
|
@@ -23435,21 +23437,39 @@ function DataGrid({
|
|
|
23435
23437
|
)
|
|
23436
23438
|
] }, field.name);
|
|
23437
23439
|
}) }) }),
|
|
23438
|
-
primaryActions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "px-4 py-3 mt-auto border-t border-border", children: /* @__PURE__ */
|
|
23439
|
-
|
|
23440
|
-
|
|
23441
|
-
|
|
23442
|
-
|
|
23443
|
-
|
|
23444
|
-
|
|
23445
|
-
|
|
23446
|
-
|
|
23447
|
-
|
|
23448
|
-
|
|
23449
|
-
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23440
|
+
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: [
|
|
23441
|
+
(maxInlineActions != null ? primaryActions.slice(0, maxInlineActions) : primaryActions).map((action, idx) => /* @__PURE__ */ jsxs(
|
|
23442
|
+
Button,
|
|
23443
|
+
{
|
|
23444
|
+
variant: action.variant === "primary" ? "primary" : "ghost",
|
|
23445
|
+
size: "sm",
|
|
23446
|
+
onClick: handleActionClick(action, itemData),
|
|
23447
|
+
"data-testid": `action-${action.event}`,
|
|
23448
|
+
"data-row-id": String(itemData.id),
|
|
23449
|
+
children: [
|
|
23450
|
+
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
23451
|
+
action.label
|
|
23452
|
+
]
|
|
23453
|
+
},
|
|
23454
|
+
idx
|
|
23455
|
+
)),
|
|
23456
|
+
maxInlineActions != null && primaryActions.length > maxInlineActions && /* @__PURE__ */ jsx(
|
|
23457
|
+
Menu,
|
|
23458
|
+
{
|
|
23459
|
+
position: "bottom-end",
|
|
23460
|
+
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" }) }),
|
|
23461
|
+
items: primaryActions.slice(maxInlineActions).map((action) => ({
|
|
23462
|
+
label: action.label,
|
|
23463
|
+
icon: action.icon,
|
|
23464
|
+
event: action.event,
|
|
23465
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
23466
|
+
id: itemData.id,
|
|
23467
|
+
row: itemData
|
|
23468
|
+
})
|
|
23469
|
+
}))
|
|
23470
|
+
}
|
|
23471
|
+
)
|
|
23472
|
+
] }) })
|
|
23453
23473
|
]
|
|
23454
23474
|
},
|
|
23455
23475
|
id
|
|
@@ -23499,6 +23519,7 @@ var init_DataGrid = __esm({
|
|
|
23499
23519
|
init_Button();
|
|
23500
23520
|
init_Icon();
|
|
23501
23521
|
init_InfiniteScrollSentinel();
|
|
23522
|
+
init_Menu();
|
|
23502
23523
|
init_useDataDnd();
|
|
23503
23524
|
dataGridLog = createLogger("almadar:ui:data-grid");
|
|
23504
23525
|
BADGE_VARIANTS = /* @__PURE__ */ new Set([
|
|
@@ -23578,6 +23599,7 @@ function DataList({
|
|
|
23578
23599
|
fields,
|
|
23579
23600
|
columns,
|
|
23580
23601
|
itemActions,
|
|
23602
|
+
maxInlineActions,
|
|
23581
23603
|
itemClickEvent,
|
|
23582
23604
|
gap = "none",
|
|
23583
23605
|
variant = "default",
|
|
@@ -23668,6 +23690,46 @@ function DataList({
|
|
|
23668
23690
|
};
|
|
23669
23691
|
eventBus.emit(`UI:${action.event}`, payload);
|
|
23670
23692
|
};
|
|
23693
|
+
const renderItemActions = (itemData) => {
|
|
23694
|
+
if (!itemActions || itemActions.length === 0) return null;
|
|
23695
|
+
const inline = maxInlineActions != null ? itemActions.slice(0, maxInlineActions) : itemActions;
|
|
23696
|
+
const overflow = maxInlineActions != null ? itemActions.slice(maxInlineActions) : [];
|
|
23697
|
+
return /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "flex-shrink-0", children: [
|
|
23698
|
+
inline.map((action, idx) => /* @__PURE__ */ jsxs(
|
|
23699
|
+
Button,
|
|
23700
|
+
{
|
|
23701
|
+
variant: action.variant ?? "ghost",
|
|
23702
|
+
size: "sm",
|
|
23703
|
+
onClick: handleActionClick(action, itemData),
|
|
23704
|
+
"data-testid": `action-${action.event}`,
|
|
23705
|
+
"data-row-id": String(itemData.id),
|
|
23706
|
+
className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
|
|
23707
|
+
children: [
|
|
23708
|
+
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
23709
|
+
action.label
|
|
23710
|
+
]
|
|
23711
|
+
},
|
|
23712
|
+
idx
|
|
23713
|
+
)),
|
|
23714
|
+
overflow.length > 0 && /* @__PURE__ */ jsx(
|
|
23715
|
+
Menu,
|
|
23716
|
+
{
|
|
23717
|
+
position: "bottom-end",
|
|
23718
|
+
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" }) }),
|
|
23719
|
+
items: overflow.map((action) => ({
|
|
23720
|
+
label: action.label,
|
|
23721
|
+
icon: action.icon,
|
|
23722
|
+
event: action.event,
|
|
23723
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
23724
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
23725
|
+
id: itemData.id,
|
|
23726
|
+
row: itemData
|
|
23727
|
+
})
|
|
23728
|
+
}))
|
|
23729
|
+
}
|
|
23730
|
+
)
|
|
23731
|
+
] });
|
|
23732
|
+
};
|
|
23671
23733
|
const handleRowClick = (itemData) => () => {
|
|
23672
23734
|
if (!itemClickEvent) return;
|
|
23673
23735
|
const payload = {
|
|
@@ -23757,31 +23819,7 @@ function DataList({
|
|
|
23757
23819
|
/* @__PURE__ */ jsxs(Box, { "data-entity-row": true, "data-entity-id": id2, onClick: itemClickEvent ? handleRowClick(itemData) : void 0, className: cn(itemClickEvent && "cursor-pointer"), children: [
|
|
23758
23820
|
/* @__PURE__ */ jsxs(Box, { className: "group flex items-stretch gap-2", children: [
|
|
23759
23821
|
/* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: children(itemData, index) }),
|
|
23760
|
-
|
|
23761
|
-
HStack,
|
|
23762
|
-
{
|
|
23763
|
-
gap: "xs",
|
|
23764
|
-
className: "flex-shrink-0",
|
|
23765
|
-
children: itemActions.map((action, idx) => /* @__PURE__ */ jsxs(
|
|
23766
|
-
Button,
|
|
23767
|
-
{
|
|
23768
|
-
variant: action.variant ?? "ghost",
|
|
23769
|
-
size: "sm",
|
|
23770
|
-
onClick: handleActionClick(action, itemData),
|
|
23771
|
-
"data-testid": `action-${action.event}`,
|
|
23772
|
-
"data-row-id": String(itemData.id),
|
|
23773
|
-
className: cn(
|
|
23774
|
-
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
23775
|
-
),
|
|
23776
|
-
children: [
|
|
23777
|
-
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
23778
|
-
action.label
|
|
23779
|
-
]
|
|
23780
|
-
},
|
|
23781
|
-
idx
|
|
23782
|
-
))
|
|
23783
|
-
}
|
|
23784
|
-
)
|
|
23822
|
+
renderItemActions(itemData)
|
|
23785
23823
|
] }),
|
|
23786
23824
|
isCard && !isLast && /* @__PURE__ */ jsx(Box, { className: "mx-6 border-b border-border/40" })
|
|
23787
23825
|
] }, id2)
|
|
@@ -23852,24 +23890,7 @@ function DataList({
|
|
|
23852
23890
|
] }, field.name);
|
|
23853
23891
|
})
|
|
23854
23892
|
] }),
|
|
23855
|
-
|
|
23856
|
-
Button,
|
|
23857
|
-
{
|
|
23858
|
-
variant: action.variant ?? "ghost",
|
|
23859
|
-
size: "sm",
|
|
23860
|
-
onClick: handleActionClick(action, itemData),
|
|
23861
|
-
"data-testid": `action-${action.event}`,
|
|
23862
|
-
"data-row-id": String(itemData.id),
|
|
23863
|
-
className: cn(
|
|
23864
|
-
action.variant === "danger" && "text-error hover:bg-error/10"
|
|
23865
|
-
),
|
|
23866
|
-
children: [
|
|
23867
|
-
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
23868
|
-
action.label
|
|
23869
|
-
]
|
|
23870
|
-
},
|
|
23871
|
-
idx
|
|
23872
|
-
)) })
|
|
23893
|
+
renderItemActions(itemData)
|
|
23873
23894
|
]
|
|
23874
23895
|
}
|
|
23875
23896
|
),
|
|
@@ -23939,6 +23960,7 @@ var init_DataList = __esm({
|
|
|
23939
23960
|
init_ProgressBar();
|
|
23940
23961
|
init_Divider();
|
|
23941
23962
|
init_InfiniteScrollSentinel();
|
|
23963
|
+
init_Menu();
|
|
23942
23964
|
init_useDataDnd();
|
|
23943
23965
|
dataListLog = createLogger("almadar:ui:data-list");
|
|
23944
23966
|
listLookStyles = {
|
|
@@ -28984,6 +29006,7 @@ function TableView({
|
|
|
28984
29006
|
columns,
|
|
28985
29007
|
fields,
|
|
28986
29008
|
itemActions,
|
|
29009
|
+
maxInlineActions,
|
|
28987
29010
|
selectable = false,
|
|
28988
29011
|
selectEvent,
|
|
28989
29012
|
selectedIds,
|
|
@@ -29166,22 +29189,41 @@ function TableView({
|
|
|
29166
29189
|
}
|
|
29167
29190
|
return /* @__PURE__ */ jsx(Box, { role: "cell", className: cellBase, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: formatCell(raw, col.format) }) }, col.key);
|
|
29168
29191
|
}),
|
|
29169
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */
|
|
29170
|
-
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
|
|
29174
|
-
|
|
29175
|
-
|
|
29176
|
-
|
|
29177
|
-
|
|
29178
|
-
|
|
29179
|
-
|
|
29180
|
-
|
|
29181
|
-
|
|
29182
|
-
|
|
29183
|
-
|
|
29184
|
-
|
|
29192
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxs(HStack, { gap: "xs", className: "flex-shrink-0 opacity-60 group-hover:opacity-100 transition-opacity", children: [
|
|
29193
|
+
(maxInlineActions != null ? itemActions.slice(0, maxInlineActions) : itemActions).map((action, i) => /* @__PURE__ */ jsxs(
|
|
29194
|
+
Button,
|
|
29195
|
+
{
|
|
29196
|
+
variant: action.variant ?? "ghost",
|
|
29197
|
+
size: "sm",
|
|
29198
|
+
onClick: handleActionClick(action, row),
|
|
29199
|
+
"data-testid": `action-${action.event}`,
|
|
29200
|
+
"data-row-id": String(row.id),
|
|
29201
|
+
className: cn(action.variant === "danger" && "text-error hover:bg-error/10"),
|
|
29202
|
+
children: [
|
|
29203
|
+
action.icon && /* @__PURE__ */ jsx(Icon, { name: action.icon, size: "xs", className: "mr-1" }),
|
|
29204
|
+
action.label
|
|
29205
|
+
]
|
|
29206
|
+
},
|
|
29207
|
+
i
|
|
29208
|
+
)),
|
|
29209
|
+
maxInlineActions != null && itemActions.length > maxInlineActions && /* @__PURE__ */ jsx(
|
|
29210
|
+
Menu,
|
|
29211
|
+
{
|
|
29212
|
+
position: "bottom-end",
|
|
29213
|
+
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" }) }),
|
|
29214
|
+
items: itemActions.slice(maxInlineActions).map((action) => ({
|
|
29215
|
+
label: action.label,
|
|
29216
|
+
icon: action.icon,
|
|
29217
|
+
event: action.event,
|
|
29218
|
+
variant: action.variant === "danger" ? "danger" : "default",
|
|
29219
|
+
onClick: () => eventBus.emit(`UI:${action.event}`, {
|
|
29220
|
+
id: row.id,
|
|
29221
|
+
row
|
|
29222
|
+
})
|
|
29223
|
+
}))
|
|
29224
|
+
}
|
|
29225
|
+
)
|
|
29226
|
+
] })
|
|
29185
29227
|
]
|
|
29186
29228
|
}
|
|
29187
29229
|
);
|
|
@@ -29229,6 +29271,7 @@ var init_TableView = __esm({
|
|
|
29229
29271
|
init_Icon();
|
|
29230
29272
|
init_Checkbox();
|
|
29231
29273
|
init_Divider();
|
|
29274
|
+
init_Menu();
|
|
29232
29275
|
init_useDataDnd();
|
|
29233
29276
|
createLogger("almadar:ui:table-view");
|
|
29234
29277
|
alignClass = {
|
|
@@ -29242,11 +29285,11 @@ var init_TableView = __esm({
|
|
|
29242
29285
|
semibold: "font-semibold"
|
|
29243
29286
|
};
|
|
29244
29287
|
LOOKS = {
|
|
29245
|
-
dense: { rowPad: "px-
|
|
29246
|
-
spacious: { rowPad: "px-
|
|
29247
|
-
striped: { rowPad: "px-
|
|
29248
|
-
borderless: { rowPad: "px-
|
|
29249
|
-
bordered: { rowPad: "px-
|
|
29288
|
+
dense: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true },
|
|
29289
|
+
spacious: { rowPad: "px-card-lg py-card-md", headPad: "px-card-lg py-card-sm", striped: false, divider: true },
|
|
29290
|
+
striped: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: true, divider: false },
|
|
29291
|
+
borderless: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: false },
|
|
29292
|
+
bordered: { rowPad: "px-card-md py-card-sm", headPad: "px-card-md py-card-sm", striped: false, divider: true }
|
|
29250
29293
|
};
|
|
29251
29294
|
TableView.displayName = "TableView";
|
|
29252
29295
|
}
|
|
@@ -49562,11 +49605,13 @@ function OrbPreview({
|
|
|
49562
49605
|
return match?.page.name;
|
|
49563
49606
|
}, [pages, initialPagePath]);
|
|
49564
49607
|
const [currentPage, setCurrentPage] = useState(initialPageName);
|
|
49608
|
+
const prevInitialPagePathRef = useRef(initialPagePath);
|
|
49565
49609
|
useEffect(() => {
|
|
49566
|
-
if (
|
|
49610
|
+
if (prevInitialPagePathRef.current !== initialPagePath) {
|
|
49611
|
+
prevInitialPagePathRef.current = initialPagePath;
|
|
49567
49612
|
setCurrentPage(initialPageName);
|
|
49568
49613
|
}
|
|
49569
|
-
}, [
|
|
49614
|
+
}, [initialPagePath, initialPageName]);
|
|
49570
49615
|
const handleNavigate = useCallback((path) => {
|
|
49571
49616
|
const match = pages.find(({ page }) => page.path === path);
|
|
49572
49617
|
navLog.debug("handleNavigate", () => ({
|