@almadar/ui 3.4.0 → 3.5.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 +73 -58
- package/dist/avl/index.js +73 -58
- package/dist/components/atoms/Avatar.d.ts +2 -2
- package/dist/components/atoms/Box.d.ts +3 -3
- package/dist/components/atoms/Button.d.ts +2 -2
- package/dist/components/atoms/InfiniteScrollSentinel.d.ts +3 -2
- package/dist/components/atoms/RangeSlider.d.ts +2 -2
- package/dist/components/atoms/Stack.d.ts +2 -2
- package/dist/components/atoms/TextHighlight.d.ts +1 -1
- package/dist/components/atoms/game/ControlButton.d.ts +3 -2
- package/dist/components/index.cjs +73 -55
- package/dist/components/index.js +73 -55
- package/dist/components/molecules/Alert.d.ts +2 -1
- package/dist/components/molecules/CalendarGrid.d.ts +2 -1
- package/dist/components/molecules/Card.d.ts +2 -2
- package/dist/components/molecules/DataGrid.d.ts +2 -2
- package/dist/components/molecules/DataList.d.ts +5 -5
- package/dist/components/molecules/Drawer.d.ts +2 -1
- package/dist/components/molecules/NumberStepper.d.ts +2 -2
- package/dist/components/molecules/PullToRefresh.d.ts +3 -2
- package/dist/components/molecules/SortableList.d.ts +5 -4
- package/dist/components/molecules/StarRating.d.ts +2 -2
- package/dist/components/molecules/SwipeableRow.d.ts +3 -3
- package/dist/components/molecules/UploadDropZone.d.ts +2 -2
- package/dist/components/molecules/game/DialogueBox.d.ts +3 -2
- package/dist/components/molecules/game/GameMenu.d.ts +3 -3
- package/dist/components/molecules/game/GameOverScreen.d.ts +3 -2
- package/dist/components/molecules/game/InventoryPanel.d.ts +3 -2
- package/dist/components/organisms/ComponentPatterns.d.ts +52 -22
- package/dist/components/organisms/CustomPattern.d.ts +3 -3
- package/dist/components/organisms/GraphCanvas.d.ts +3 -2
- package/dist/components/organisms/game/three/index.cjs +0 -3
- package/dist/components/organisms/game/three/index.js +0 -3
- package/dist/docs/index.cjs +0 -3
- package/dist/docs/index.d.cts +5 -5
- package/dist/docs/index.js +0 -3
- package/dist/hooks/event-bus-types.d.ts +10 -10
- package/dist/hooks/index.cjs +0 -3
- package/dist/hooks/index.js +0 -3
- package/dist/hooks/useDraggable.d.ts +2 -1
- package/dist/hooks/useEventBus.d.ts +2 -1
- package/dist/lib/verificationRegistry.d.ts +2 -2
- package/dist/marketing/index.cjs +0 -3
- package/dist/marketing/index.d.cts +5 -5
- package/dist/marketing/index.js +0 -3
- package/dist/providers/index.cjs +73 -58
- package/dist/providers/index.js +73 -58
- package/dist/runtime/createClientEffectHandlers.d.ts +2 -1
- package/dist/runtime/index.cjs +73 -55
- package/dist/runtime/index.js +73 -55
- package/package.json +6 -3
package/dist/providers/index.cjs
CHANGED
|
@@ -474,9 +474,6 @@ var init_useEventBus = __esm({
|
|
|
474
474
|
emit: (type, payload, source) => {
|
|
475
475
|
const event = {
|
|
476
476
|
type,
|
|
477
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
478
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
479
|
-
// payload as EventPayload which listeners consume directly.
|
|
480
477
|
payload,
|
|
481
478
|
timestamp: Date.now(),
|
|
482
479
|
source
|
|
@@ -8032,38 +8029,16 @@ var init_MapView = __esm({
|
|
|
8032
8029
|
}
|
|
8033
8030
|
});
|
|
8034
8031
|
function ButtonPattern({
|
|
8035
|
-
|
|
8036
|
-
variant = "primary",
|
|
8037
|
-
size = "md",
|
|
8038
|
-
disabled = false,
|
|
8032
|
+
action,
|
|
8039
8033
|
onClick,
|
|
8040
8034
|
event,
|
|
8041
8035
|
icon,
|
|
8042
|
-
iconPosition
|
|
8043
|
-
|
|
8036
|
+
iconPosition,
|
|
8037
|
+
...rest
|
|
8044
8038
|
}) {
|
|
8045
|
-
const
|
|
8046
|
-
const
|
|
8047
|
-
|
|
8048
|
-
if (eventName && !disabled) {
|
|
8049
|
-
emit(`UI:${eventName}`, {});
|
|
8050
|
-
}
|
|
8051
|
-
};
|
|
8052
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8053
|
-
Button,
|
|
8054
|
-
{
|
|
8055
|
-
variant,
|
|
8056
|
-
size,
|
|
8057
|
-
disabled,
|
|
8058
|
-
onClick: handleClick,
|
|
8059
|
-
className,
|
|
8060
|
-
children: [
|
|
8061
|
-
icon && iconPosition === "left" && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: "sm" }),
|
|
8062
|
-
label,
|
|
8063
|
-
icon && iconPosition === "right" && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: "sm" })
|
|
8064
|
-
]
|
|
8065
|
-
}
|
|
8066
|
-
);
|
|
8039
|
+
const resolvedAction = action ?? onClick ?? event;
|
|
8040
|
+
const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
|
|
8041
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
|
|
8067
8042
|
}
|
|
8068
8043
|
function TextPattern({
|
|
8069
8044
|
content,
|
|
@@ -15994,7 +15969,11 @@ var init_CardGrid = __esm({
|
|
|
15994
15969
|
return;
|
|
15995
15970
|
}
|
|
15996
15971
|
if (action.event) {
|
|
15997
|
-
|
|
15972
|
+
const payload = {
|
|
15973
|
+
id: itemData.id,
|
|
15974
|
+
row: itemData
|
|
15975
|
+
};
|
|
15976
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
15998
15977
|
}
|
|
15999
15978
|
if (action.onClick) {
|
|
16000
15979
|
action.onClick(itemData);
|
|
@@ -18678,7 +18657,8 @@ var init_DataGrid = __esm({
|
|
|
18678
18657
|
if (next.has(id)) next.delete(id);
|
|
18679
18658
|
else next.add(id);
|
|
18680
18659
|
if (selectionEvent) {
|
|
18681
|
-
|
|
18660
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18661
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18682
18662
|
}
|
|
18683
18663
|
return next;
|
|
18684
18664
|
});
|
|
@@ -18689,7 +18669,8 @@ var init_DataGrid = __esm({
|
|
|
18689
18669
|
const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
|
|
18690
18670
|
const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
|
|
18691
18671
|
if (selectionEvent) {
|
|
18692
|
-
|
|
18672
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18673
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18693
18674
|
}
|
|
18694
18675
|
return next;
|
|
18695
18676
|
});
|
|
@@ -18701,7 +18682,11 @@ var init_DataGrid = __esm({
|
|
|
18701
18682
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18702
18683
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18703
18684
|
e.stopPropagation();
|
|
18704
|
-
|
|
18685
|
+
const payload = {
|
|
18686
|
+
id: itemData.id,
|
|
18687
|
+
row: itemData
|
|
18688
|
+
};
|
|
18689
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18705
18690
|
};
|
|
18706
18691
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18707
18692
|
const colsClass = cols ? {
|
|
@@ -19029,7 +19014,11 @@ var init_DataList = __esm({
|
|
|
19029
19014
|
);
|
|
19030
19015
|
const handleActionClick = (action, itemData) => (e) => {
|
|
19031
19016
|
e.stopPropagation();
|
|
19032
|
-
|
|
19017
|
+
const payload = {
|
|
19018
|
+
id: itemData.id,
|
|
19019
|
+
row: itemData
|
|
19020
|
+
};
|
|
19021
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
19033
19022
|
};
|
|
19034
19023
|
if (isLoading) {
|
|
19035
19024
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
|
|
@@ -27413,7 +27402,8 @@ var init_DetailPanel = __esm({
|
|
|
27413
27402
|
return;
|
|
27414
27403
|
}
|
|
27415
27404
|
if (action.event) {
|
|
27416
|
-
|
|
27405
|
+
const payload = data2 ? { id: data2.id, row: data2 } : {};
|
|
27406
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
27417
27407
|
}
|
|
27418
27408
|
if (action.onClick) {
|
|
27419
27409
|
action.onClick();
|
|
@@ -28855,9 +28845,10 @@ var init_Form = __esm({
|
|
|
28855
28845
|
};
|
|
28856
28846
|
const handleSubmit = (e) => {
|
|
28857
28847
|
e.preventDefault();
|
|
28858
|
-
|
|
28848
|
+
const payload = { data: formData };
|
|
28849
|
+
eventBus.emit(`UI:${submitEvent}`, payload);
|
|
28859
28850
|
if (onSubmit) {
|
|
28860
|
-
eventBus.emit(`UI:${onSubmit}`,
|
|
28851
|
+
eventBus.emit(`UI:${onSubmit}`, payload);
|
|
28861
28852
|
}
|
|
28862
28853
|
};
|
|
28863
28854
|
const handleCancel = () => {
|
|
@@ -30225,6 +30216,31 @@ function normalizeFields2(fields) {
|
|
|
30225
30216
|
if (!fields) return [];
|
|
30226
30217
|
return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
|
|
30227
30218
|
}
|
|
30219
|
+
function entityFieldsFromListItem(item) {
|
|
30220
|
+
const {
|
|
30221
|
+
icon: _icon,
|
|
30222
|
+
metadata: _metadata,
|
|
30223
|
+
onClick: _onClick,
|
|
30224
|
+
avatar: _avatar,
|
|
30225
|
+
_fields,
|
|
30226
|
+
...rest
|
|
30227
|
+
} = item;
|
|
30228
|
+
const result = {};
|
|
30229
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
30230
|
+
if (typeof value === "function" || value !== null && typeof value === "object" && "$$typeof" in value) {
|
|
30231
|
+
continue;
|
|
30232
|
+
}
|
|
30233
|
+
result[key] = value;
|
|
30234
|
+
}
|
|
30235
|
+
if (_fields && typeof _fields === "object") {
|
|
30236
|
+
for (const [k, v] of Object.entries(_fields)) {
|
|
30237
|
+
if (typeof v !== "function") {
|
|
30238
|
+
result[k] = v;
|
|
30239
|
+
}
|
|
30240
|
+
}
|
|
30241
|
+
}
|
|
30242
|
+
return result;
|
|
30243
|
+
}
|
|
30228
30244
|
function getStatusStyle(fieldName, value) {
|
|
30229
30245
|
const val = String(value).toLowerCase();
|
|
30230
30246
|
if (val.includes("complete") || val.includes("done"))
|
|
@@ -30428,18 +30444,17 @@ var init_List = __esm({
|
|
|
30428
30444
|
label: action.label,
|
|
30429
30445
|
event: action.event,
|
|
30430
30446
|
onClick: () => {
|
|
30447
|
+
const row = entityFieldsFromListItem(item);
|
|
30431
30448
|
if (action.navigatesTo) {
|
|
30432
30449
|
const url = action.navigatesTo.replace(
|
|
30433
30450
|
/\{\{(\w+)\}\}/g,
|
|
30434
|
-
(_, key) => String(
|
|
30451
|
+
(_, key) => String(row[key] ?? item.id ?? "")
|
|
30435
30452
|
);
|
|
30436
|
-
eventBus.emit("UI:NAVIGATE", { url, row
|
|
30453
|
+
eventBus.emit("UI:NAVIGATE", { url, row });
|
|
30437
30454
|
return;
|
|
30438
30455
|
}
|
|
30439
30456
|
if (action.event) {
|
|
30440
|
-
eventBus.emit(`UI:${action.event}`, {
|
|
30441
|
-
row: item
|
|
30442
|
-
});
|
|
30457
|
+
eventBus.emit(`UI:${action.event}`, { row });
|
|
30443
30458
|
}
|
|
30444
30459
|
}
|
|
30445
30460
|
}));
|
|
@@ -30519,7 +30534,7 @@ var init_List = __esm({
|
|
|
30519
30534
|
);
|
|
30520
30535
|
const hasExplicitClick = !!(viewAction?.event || item.onClick);
|
|
30521
30536
|
const rowAction = viewAction?.event ?? "VIEW";
|
|
30522
|
-
const rowActionPayload = { row: item };
|
|
30537
|
+
const rowActionPayload = { row: entityFieldsFromListItem(item) };
|
|
30523
30538
|
const primaryField = effectiveFieldNames?.[0];
|
|
30524
30539
|
const statusField = effectiveFieldNames?.find(
|
|
30525
30540
|
(f3) => f3.toLowerCase().includes("status")
|
|
@@ -36354,16 +36369,19 @@ var init_Timeline = __esm({
|
|
|
36354
36369
|
] }),
|
|
36355
36370
|
item.description && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
|
|
36356
36371
|
item.tags && item.tags.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", wrap: true, children: item.tags.map((tag, tagIdx) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", children: tag }, tagIdx)) }),
|
|
36357
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) =>
|
|
36358
|
-
|
|
36359
|
-
|
|
36360
|
-
|
|
36361
|
-
|
|
36362
|
-
|
|
36363
|
-
|
|
36364
|
-
|
|
36365
|
-
|
|
36366
|
-
|
|
36372
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) => {
|
|
36373
|
+
const { icon: _icon, ...rowSafe } = item;
|
|
36374
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
36375
|
+
Box,
|
|
36376
|
+
{
|
|
36377
|
+
action: action.event,
|
|
36378
|
+
actionPayload: { row: rowSafe },
|
|
36379
|
+
className: "cursor-pointer hover:opacity-80 transition-opacity",
|
|
36380
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", children: action.label })
|
|
36381
|
+
},
|
|
36382
|
+
actionIdx
|
|
36383
|
+
);
|
|
36384
|
+
}) })
|
|
36367
36385
|
] })
|
|
36368
36386
|
] }, item.id);
|
|
36369
36387
|
}) })
|
|
@@ -38258,9 +38276,6 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
38258
38276
|
const emit = React115.useCallback((type, payload, source) => {
|
|
38259
38277
|
const event = {
|
|
38260
38278
|
type,
|
|
38261
|
-
// Narrow at the bus boundary: public emit takes Record for ergonomics
|
|
38262
|
-
// (generic UI components pass consumer-defined rows) while the envelope
|
|
38263
|
-
// stores the payload as EventPayload for listeners.
|
|
38264
38279
|
payload,
|
|
38265
38280
|
timestamp: Date.now(),
|
|
38266
38281
|
source
|
package/dist/providers/index.js
CHANGED
|
@@ -429,9 +429,6 @@ var init_useEventBus = __esm({
|
|
|
429
429
|
emit: (type, payload, source) => {
|
|
430
430
|
const event = {
|
|
431
431
|
type,
|
|
432
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
433
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
434
|
-
// payload as EventPayload which listeners consume directly.
|
|
435
432
|
payload,
|
|
436
433
|
timestamp: Date.now(),
|
|
437
434
|
source
|
|
@@ -7987,38 +7984,16 @@ var init_MapView = __esm({
|
|
|
7987
7984
|
}
|
|
7988
7985
|
});
|
|
7989
7986
|
function ButtonPattern({
|
|
7990
|
-
|
|
7991
|
-
variant = "primary",
|
|
7992
|
-
size = "md",
|
|
7993
|
-
disabled = false,
|
|
7987
|
+
action,
|
|
7994
7988
|
onClick,
|
|
7995
7989
|
event,
|
|
7996
7990
|
icon,
|
|
7997
|
-
iconPosition
|
|
7998
|
-
|
|
7991
|
+
iconPosition,
|
|
7992
|
+
...rest
|
|
7999
7993
|
}) {
|
|
8000
|
-
const
|
|
8001
|
-
const
|
|
8002
|
-
|
|
8003
|
-
if (eventName && !disabled) {
|
|
8004
|
-
emit(`UI:${eventName}`, {});
|
|
8005
|
-
}
|
|
8006
|
-
};
|
|
8007
|
-
return /* @__PURE__ */ jsxs(
|
|
8008
|
-
Button,
|
|
8009
|
-
{
|
|
8010
|
-
variant,
|
|
8011
|
-
size,
|
|
8012
|
-
disabled,
|
|
8013
|
-
onClick: handleClick,
|
|
8014
|
-
className,
|
|
8015
|
-
children: [
|
|
8016
|
-
icon && iconPosition === "left" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }),
|
|
8017
|
-
label,
|
|
8018
|
-
icon && iconPosition === "right" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" })
|
|
8019
|
-
]
|
|
8020
|
-
}
|
|
8021
|
-
);
|
|
7994
|
+
const resolvedAction = action ?? onClick ?? event;
|
|
7995
|
+
const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
|
|
7996
|
+
return /* @__PURE__ */ jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
|
|
8022
7997
|
}
|
|
8023
7998
|
function TextPattern({
|
|
8024
7999
|
content,
|
|
@@ -15949,7 +15924,11 @@ var init_CardGrid = __esm({
|
|
|
15949
15924
|
return;
|
|
15950
15925
|
}
|
|
15951
15926
|
if (action.event) {
|
|
15952
|
-
|
|
15927
|
+
const payload = {
|
|
15928
|
+
id: itemData.id,
|
|
15929
|
+
row: itemData
|
|
15930
|
+
};
|
|
15931
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
15953
15932
|
}
|
|
15954
15933
|
if (action.onClick) {
|
|
15955
15934
|
action.onClick(itemData);
|
|
@@ -18633,7 +18612,8 @@ var init_DataGrid = __esm({
|
|
|
18633
18612
|
if (next.has(id)) next.delete(id);
|
|
18634
18613
|
else next.add(id);
|
|
18635
18614
|
if (selectionEvent) {
|
|
18636
|
-
|
|
18615
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18616
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18637
18617
|
}
|
|
18638
18618
|
return next;
|
|
18639
18619
|
});
|
|
@@ -18644,7 +18624,8 @@ var init_DataGrid = __esm({
|
|
|
18644
18624
|
const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
|
|
18645
18625
|
const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
|
|
18646
18626
|
if (selectionEvent) {
|
|
18647
|
-
|
|
18627
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18628
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18648
18629
|
}
|
|
18649
18630
|
return next;
|
|
18650
18631
|
});
|
|
@@ -18656,7 +18637,11 @@ var init_DataGrid = __esm({
|
|
|
18656
18637
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18657
18638
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18658
18639
|
e.stopPropagation();
|
|
18659
|
-
|
|
18640
|
+
const payload = {
|
|
18641
|
+
id: itemData.id,
|
|
18642
|
+
row: itemData
|
|
18643
|
+
};
|
|
18644
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18660
18645
|
};
|
|
18661
18646
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18662
18647
|
const colsClass = cols ? {
|
|
@@ -18984,7 +18969,11 @@ var init_DataList = __esm({
|
|
|
18984
18969
|
);
|
|
18985
18970
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18986
18971
|
e.stopPropagation();
|
|
18987
|
-
|
|
18972
|
+
const payload = {
|
|
18973
|
+
id: itemData.id,
|
|
18974
|
+
row: itemData
|
|
18975
|
+
};
|
|
18976
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18988
18977
|
};
|
|
18989
18978
|
if (isLoading) {
|
|
18990
18979
|
return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
|
|
@@ -27368,7 +27357,8 @@ var init_DetailPanel = __esm({
|
|
|
27368
27357
|
return;
|
|
27369
27358
|
}
|
|
27370
27359
|
if (action.event) {
|
|
27371
|
-
|
|
27360
|
+
const payload = data2 ? { id: data2.id, row: data2 } : {};
|
|
27361
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
27372
27362
|
}
|
|
27373
27363
|
if (action.onClick) {
|
|
27374
27364
|
action.onClick();
|
|
@@ -28810,9 +28800,10 @@ var init_Form = __esm({
|
|
|
28810
28800
|
};
|
|
28811
28801
|
const handleSubmit = (e) => {
|
|
28812
28802
|
e.preventDefault();
|
|
28813
|
-
|
|
28803
|
+
const payload = { data: formData };
|
|
28804
|
+
eventBus.emit(`UI:${submitEvent}`, payload);
|
|
28814
28805
|
if (onSubmit) {
|
|
28815
|
-
eventBus.emit(`UI:${onSubmit}`,
|
|
28806
|
+
eventBus.emit(`UI:${onSubmit}`, payload);
|
|
28816
28807
|
}
|
|
28817
28808
|
};
|
|
28818
28809
|
const handleCancel = () => {
|
|
@@ -30180,6 +30171,31 @@ function normalizeFields2(fields) {
|
|
|
30180
30171
|
if (!fields) return [];
|
|
30181
30172
|
return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
|
|
30182
30173
|
}
|
|
30174
|
+
function entityFieldsFromListItem(item) {
|
|
30175
|
+
const {
|
|
30176
|
+
icon: _icon,
|
|
30177
|
+
metadata: _metadata,
|
|
30178
|
+
onClick: _onClick,
|
|
30179
|
+
avatar: _avatar,
|
|
30180
|
+
_fields,
|
|
30181
|
+
...rest
|
|
30182
|
+
} = item;
|
|
30183
|
+
const result = {};
|
|
30184
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
30185
|
+
if (typeof value === "function" || value !== null && typeof value === "object" && "$$typeof" in value) {
|
|
30186
|
+
continue;
|
|
30187
|
+
}
|
|
30188
|
+
result[key] = value;
|
|
30189
|
+
}
|
|
30190
|
+
if (_fields && typeof _fields === "object") {
|
|
30191
|
+
for (const [k, v] of Object.entries(_fields)) {
|
|
30192
|
+
if (typeof v !== "function") {
|
|
30193
|
+
result[k] = v;
|
|
30194
|
+
}
|
|
30195
|
+
}
|
|
30196
|
+
}
|
|
30197
|
+
return result;
|
|
30198
|
+
}
|
|
30183
30199
|
function getStatusStyle(fieldName, value) {
|
|
30184
30200
|
const val = String(value).toLowerCase();
|
|
30185
30201
|
if (val.includes("complete") || val.includes("done"))
|
|
@@ -30383,18 +30399,17 @@ var init_List = __esm({
|
|
|
30383
30399
|
label: action.label,
|
|
30384
30400
|
event: action.event,
|
|
30385
30401
|
onClick: () => {
|
|
30402
|
+
const row = entityFieldsFromListItem(item);
|
|
30386
30403
|
if (action.navigatesTo) {
|
|
30387
30404
|
const url = action.navigatesTo.replace(
|
|
30388
30405
|
/\{\{(\w+)\}\}/g,
|
|
30389
|
-
(_, key) => String(
|
|
30406
|
+
(_, key) => String(row[key] ?? item.id ?? "")
|
|
30390
30407
|
);
|
|
30391
|
-
eventBus.emit("UI:NAVIGATE", { url, row
|
|
30408
|
+
eventBus.emit("UI:NAVIGATE", { url, row });
|
|
30392
30409
|
return;
|
|
30393
30410
|
}
|
|
30394
30411
|
if (action.event) {
|
|
30395
|
-
eventBus.emit(`UI:${action.event}`, {
|
|
30396
|
-
row: item
|
|
30397
|
-
});
|
|
30412
|
+
eventBus.emit(`UI:${action.event}`, { row });
|
|
30398
30413
|
}
|
|
30399
30414
|
}
|
|
30400
30415
|
}));
|
|
@@ -30474,7 +30489,7 @@ var init_List = __esm({
|
|
|
30474
30489
|
);
|
|
30475
30490
|
const hasExplicitClick = !!(viewAction?.event || item.onClick);
|
|
30476
30491
|
const rowAction = viewAction?.event ?? "VIEW";
|
|
30477
|
-
const rowActionPayload = { row: item };
|
|
30492
|
+
const rowActionPayload = { row: entityFieldsFromListItem(item) };
|
|
30478
30493
|
const primaryField = effectiveFieldNames?.[0];
|
|
30479
30494
|
const statusField = effectiveFieldNames?.find(
|
|
30480
30495
|
(f3) => f3.toLowerCase().includes("status")
|
|
@@ -36309,16 +36324,19 @@ var init_Timeline = __esm({
|
|
|
36309
36324
|
] }),
|
|
36310
36325
|
item.description && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
|
|
36311
36326
|
item.tags && item.tags.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", wrap: true, children: item.tags.map((tag, tagIdx) => /* @__PURE__ */ jsx(Badge, { variant: "default", children: tag }, tagIdx)) }),
|
|
36312
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) =>
|
|
36313
|
-
|
|
36314
|
-
|
|
36315
|
-
|
|
36316
|
-
|
|
36317
|
-
|
|
36318
|
-
|
|
36319
|
-
|
|
36320
|
-
|
|
36321
|
-
|
|
36327
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) => {
|
|
36328
|
+
const { icon: _icon, ...rowSafe } = item;
|
|
36329
|
+
return /* @__PURE__ */ jsx(
|
|
36330
|
+
Box,
|
|
36331
|
+
{
|
|
36332
|
+
action: action.event,
|
|
36333
|
+
actionPayload: { row: rowSafe },
|
|
36334
|
+
className: "cursor-pointer hover:opacity-80 transition-opacity",
|
|
36335
|
+
children: /* @__PURE__ */ jsx(Badge, { variant: "default", children: action.label })
|
|
36336
|
+
},
|
|
36337
|
+
actionIdx
|
|
36338
|
+
);
|
|
36339
|
+
}) })
|
|
36322
36340
|
] })
|
|
36323
36341
|
] }, item.id);
|
|
36324
36342
|
}) })
|
|
@@ -38213,9 +38231,6 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
38213
38231
|
const emit = useCallback((type, payload, source) => {
|
|
38214
38232
|
const event = {
|
|
38215
38233
|
type,
|
|
38216
|
-
// Narrow at the bus boundary: public emit takes Record for ergonomics
|
|
38217
|
-
// (generic UI components pass consumer-defined rows) while the envelope
|
|
38218
|
-
// stores the payload as EventPayload for listeners.
|
|
38219
38234
|
payload,
|
|
38220
38235
|
timestamp: Date.now(),
|
|
38221
38236
|
source
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
+
import type { EventPayload } from '@almadar/core';
|
|
8
9
|
import type { EffectHandlers } from '@almadar/runtime';
|
|
9
10
|
export interface ClientEventBus {
|
|
10
|
-
emit: (type: string, payload?:
|
|
11
|
+
emit: (type: string, payload?: EventPayload) => void;
|
|
11
12
|
}
|
|
12
13
|
export interface SlotSetter {
|
|
13
14
|
addPattern: (slot: string, pattern: unknown, props?: Record<string, unknown>) => void;
|