@almadar/ui 3.3.1 → 3.5.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 +67 -30
- package/dist/avl/index.js +67 -30
- package/dist/components/atoms/Avatar.d.ts +3 -2
- package/dist/components/atoms/Box.d.ts +4 -3
- package/dist/components/atoms/Button.d.ts +3 -2
- package/dist/components/atoms/InfiniteScrollSentinel.d.ts +3 -2
- package/dist/components/atoms/Input.d.ts +3 -2
- package/dist/components/atoms/Overlay.d.ts +2 -1
- package/dist/components/atoms/Radio.d.ts +2 -1
- package/dist/components/atoms/RangeSlider.d.ts +3 -2
- package/dist/components/atoms/Select.d.ts +2 -1
- package/dist/components/atoms/Stack.d.ts +3 -2
- package/dist/components/atoms/TextHighlight.d.ts +3 -2
- package/dist/components/atoms/Textarea.d.ts +2 -1
- package/dist/components/atoms/game/ControlButton.d.ts +3 -2
- package/dist/components/atoms/game/Sprite.d.ts +2 -1
- package/dist/components/index.cjs +67 -27
- package/dist/components/index.js +67 -27
- 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 +3 -2
- package/dist/components/molecules/DataGrid.d.ts +4 -3
- package/dist/components/molecules/DataList.d.ts +7 -6
- package/dist/components/molecules/Drawer.d.ts +2 -1
- package/dist/components/molecules/NumberStepper.d.ts +3 -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 +3 -2
- package/dist/components/molecules/SwipeableRow.d.ts +4 -3
- package/dist/components/molecules/UploadDropZone.d.ts +3 -2
- package/dist/components/molecules/game/DialogueBox.d.ts +3 -2
- package/dist/components/molecules/game/GameMenu.d.ts +4 -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/CardGrid.d.ts +3 -2
- package/dist/components/organisms/CustomPattern.d.ts +5 -4
- package/dist/components/organisms/DataTable.d.ts +2 -1
- package/dist/components/organisms/Form.d.ts +3 -2
- package/dist/components/organisms/GraphCanvas.d.ts +3 -2
- package/dist/components/organisms/List.d.ts +4 -2
- package/dist/components/organisms/Timeline.d.ts +2 -1
- 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 +10 -9
- 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 +8 -7
- package/dist/marketing/index.js +0 -3
- package/dist/providers/index.cjs +67 -30
- package/dist/providers/index.js +67 -30
- package/dist/runtime/createClientEffectHandlers.d.ts +2 -1
- package/dist/runtime/index.cjs +67 -27
- package/dist/runtime/index.js +67 -27
- package/package.json +3 -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
|
|
@@ -15994,7 +15991,11 @@ var init_CardGrid = __esm({
|
|
|
15994
15991
|
return;
|
|
15995
15992
|
}
|
|
15996
15993
|
if (action.event) {
|
|
15997
|
-
|
|
15994
|
+
const payload = {
|
|
15995
|
+
id: itemData.id,
|
|
15996
|
+
row: itemData
|
|
15997
|
+
};
|
|
15998
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
15998
15999
|
}
|
|
15999
16000
|
if (action.onClick) {
|
|
16000
16001
|
action.onClick(itemData);
|
|
@@ -18678,7 +18679,8 @@ var init_DataGrid = __esm({
|
|
|
18678
18679
|
if (next.has(id)) next.delete(id);
|
|
18679
18680
|
else next.add(id);
|
|
18680
18681
|
if (selectionEvent) {
|
|
18681
|
-
|
|
18682
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18683
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18682
18684
|
}
|
|
18683
18685
|
return next;
|
|
18684
18686
|
});
|
|
@@ -18689,7 +18691,8 @@ var init_DataGrid = __esm({
|
|
|
18689
18691
|
const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
|
|
18690
18692
|
const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
|
|
18691
18693
|
if (selectionEvent) {
|
|
18692
|
-
|
|
18694
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18695
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18693
18696
|
}
|
|
18694
18697
|
return next;
|
|
18695
18698
|
});
|
|
@@ -18701,7 +18704,11 @@ var init_DataGrid = __esm({
|
|
|
18701
18704
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18702
18705
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18703
18706
|
e.stopPropagation();
|
|
18704
|
-
|
|
18707
|
+
const payload = {
|
|
18708
|
+
id: itemData.id,
|
|
18709
|
+
row: itemData
|
|
18710
|
+
};
|
|
18711
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18705
18712
|
};
|
|
18706
18713
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18707
18714
|
const colsClass = cols ? {
|
|
@@ -19029,7 +19036,11 @@ var init_DataList = __esm({
|
|
|
19029
19036
|
);
|
|
19030
19037
|
const handleActionClick = (action, itemData) => (e) => {
|
|
19031
19038
|
e.stopPropagation();
|
|
19032
|
-
|
|
19039
|
+
const payload = {
|
|
19040
|
+
id: itemData.id,
|
|
19041
|
+
row: itemData
|
|
19042
|
+
};
|
|
19043
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
19033
19044
|
};
|
|
19034
19045
|
if (isLoading) {
|
|
19035
19046
|
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 +27424,8 @@ var init_DetailPanel = __esm({
|
|
|
27413
27424
|
return;
|
|
27414
27425
|
}
|
|
27415
27426
|
if (action.event) {
|
|
27416
|
-
|
|
27427
|
+
const payload = data2 ? { id: data2.id, row: data2 } : {};
|
|
27428
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
27417
27429
|
}
|
|
27418
27430
|
if (action.onClick) {
|
|
27419
27431
|
action.onClick();
|
|
@@ -28855,9 +28867,10 @@ var init_Form = __esm({
|
|
|
28855
28867
|
};
|
|
28856
28868
|
const handleSubmit = (e) => {
|
|
28857
28869
|
e.preventDefault();
|
|
28858
|
-
|
|
28870
|
+
const payload = { data: formData };
|
|
28871
|
+
eventBus.emit(`UI:${submitEvent}`, payload);
|
|
28859
28872
|
if (onSubmit) {
|
|
28860
|
-
eventBus.emit(`UI:${onSubmit}`,
|
|
28873
|
+
eventBus.emit(`UI:${onSubmit}`, payload);
|
|
28861
28874
|
}
|
|
28862
28875
|
};
|
|
28863
28876
|
const handleCancel = () => {
|
|
@@ -30225,6 +30238,31 @@ function normalizeFields2(fields) {
|
|
|
30225
30238
|
if (!fields) return [];
|
|
30226
30239
|
return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
|
|
30227
30240
|
}
|
|
30241
|
+
function entityFieldsFromListItem(item) {
|
|
30242
|
+
const {
|
|
30243
|
+
icon: _icon,
|
|
30244
|
+
metadata: _metadata,
|
|
30245
|
+
onClick: _onClick,
|
|
30246
|
+
avatar: _avatar,
|
|
30247
|
+
_fields,
|
|
30248
|
+
...rest
|
|
30249
|
+
} = item;
|
|
30250
|
+
const result = {};
|
|
30251
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
30252
|
+
if (typeof value === "function" || value !== null && typeof value === "object" && "$$typeof" in value) {
|
|
30253
|
+
continue;
|
|
30254
|
+
}
|
|
30255
|
+
result[key] = value;
|
|
30256
|
+
}
|
|
30257
|
+
if (_fields && typeof _fields === "object") {
|
|
30258
|
+
for (const [k, v] of Object.entries(_fields)) {
|
|
30259
|
+
if (typeof v !== "function") {
|
|
30260
|
+
result[k] = v;
|
|
30261
|
+
}
|
|
30262
|
+
}
|
|
30263
|
+
}
|
|
30264
|
+
return result;
|
|
30265
|
+
}
|
|
30228
30266
|
function getStatusStyle(fieldName, value) {
|
|
30229
30267
|
const val = String(value).toLowerCase();
|
|
30230
30268
|
if (val.includes("complete") || val.includes("done"))
|
|
@@ -30428,18 +30466,17 @@ var init_List = __esm({
|
|
|
30428
30466
|
label: action.label,
|
|
30429
30467
|
event: action.event,
|
|
30430
30468
|
onClick: () => {
|
|
30469
|
+
const row = entityFieldsFromListItem(item);
|
|
30431
30470
|
if (action.navigatesTo) {
|
|
30432
30471
|
const url = action.navigatesTo.replace(
|
|
30433
30472
|
/\{\{(\w+)\}\}/g,
|
|
30434
|
-
(_, key) => String(
|
|
30473
|
+
(_, key) => String(row[key] ?? item.id ?? "")
|
|
30435
30474
|
);
|
|
30436
|
-
eventBus.emit("UI:NAVIGATE", { url, row
|
|
30475
|
+
eventBus.emit("UI:NAVIGATE", { url, row });
|
|
30437
30476
|
return;
|
|
30438
30477
|
}
|
|
30439
30478
|
if (action.event) {
|
|
30440
|
-
eventBus.emit(`UI:${action.event}`, {
|
|
30441
|
-
row: item
|
|
30442
|
-
});
|
|
30479
|
+
eventBus.emit(`UI:${action.event}`, { row });
|
|
30443
30480
|
}
|
|
30444
30481
|
}
|
|
30445
30482
|
}));
|
|
@@ -30519,7 +30556,7 @@ var init_List = __esm({
|
|
|
30519
30556
|
);
|
|
30520
30557
|
const hasExplicitClick = !!(viewAction?.event || item.onClick);
|
|
30521
30558
|
const rowAction = viewAction?.event ?? "VIEW";
|
|
30522
|
-
const rowActionPayload = { row: item };
|
|
30559
|
+
const rowActionPayload = { row: entityFieldsFromListItem(item) };
|
|
30523
30560
|
const primaryField = effectiveFieldNames?.[0];
|
|
30524
30561
|
const statusField = effectiveFieldNames?.find(
|
|
30525
30562
|
(f3) => f3.toLowerCase().includes("status")
|
|
@@ -36354,16 +36391,19 @@ var init_Timeline = __esm({
|
|
|
36354
36391
|
] }),
|
|
36355
36392
|
item.description && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
|
|
36356
36393
|
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
|
-
|
|
36394
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) => {
|
|
36395
|
+
const { icon: _icon, ...rowSafe } = item;
|
|
36396
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
36397
|
+
Box,
|
|
36398
|
+
{
|
|
36399
|
+
action: action.event,
|
|
36400
|
+
actionPayload: { row: rowSafe },
|
|
36401
|
+
className: "cursor-pointer hover:opacity-80 transition-opacity",
|
|
36402
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", children: action.label })
|
|
36403
|
+
},
|
|
36404
|
+
actionIdx
|
|
36405
|
+
);
|
|
36406
|
+
}) })
|
|
36367
36407
|
] })
|
|
36368
36408
|
] }, item.id);
|
|
36369
36409
|
}) })
|
|
@@ -38258,9 +38298,6 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
38258
38298
|
const emit = React115.useCallback((type, payload, source) => {
|
|
38259
38299
|
const event = {
|
|
38260
38300
|
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
38301
|
payload,
|
|
38265
38302
|
timestamp: Date.now(),
|
|
38266
38303
|
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
|
|
@@ -15949,7 +15946,11 @@ var init_CardGrid = __esm({
|
|
|
15949
15946
|
return;
|
|
15950
15947
|
}
|
|
15951
15948
|
if (action.event) {
|
|
15952
|
-
|
|
15949
|
+
const payload = {
|
|
15950
|
+
id: itemData.id,
|
|
15951
|
+
row: itemData
|
|
15952
|
+
};
|
|
15953
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
15953
15954
|
}
|
|
15954
15955
|
if (action.onClick) {
|
|
15955
15956
|
action.onClick(itemData);
|
|
@@ -18633,7 +18634,8 @@ var init_DataGrid = __esm({
|
|
|
18633
18634
|
if (next.has(id)) next.delete(id);
|
|
18634
18635
|
else next.add(id);
|
|
18635
18636
|
if (selectionEvent) {
|
|
18636
|
-
|
|
18637
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18638
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18637
18639
|
}
|
|
18638
18640
|
return next;
|
|
18639
18641
|
});
|
|
@@ -18644,7 +18646,8 @@ var init_DataGrid = __esm({
|
|
|
18644
18646
|
const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
|
|
18645
18647
|
const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
|
|
18646
18648
|
if (selectionEvent) {
|
|
18647
|
-
|
|
18649
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18650
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18648
18651
|
}
|
|
18649
18652
|
return next;
|
|
18650
18653
|
});
|
|
@@ -18656,7 +18659,11 @@ var init_DataGrid = __esm({
|
|
|
18656
18659
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18657
18660
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18658
18661
|
e.stopPropagation();
|
|
18659
|
-
|
|
18662
|
+
const payload = {
|
|
18663
|
+
id: itemData.id,
|
|
18664
|
+
row: itemData
|
|
18665
|
+
};
|
|
18666
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18660
18667
|
};
|
|
18661
18668
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18662
18669
|
const colsClass = cols ? {
|
|
@@ -18984,7 +18991,11 @@ var init_DataList = __esm({
|
|
|
18984
18991
|
);
|
|
18985
18992
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18986
18993
|
e.stopPropagation();
|
|
18987
|
-
|
|
18994
|
+
const payload = {
|
|
18995
|
+
id: itemData.id,
|
|
18996
|
+
row: itemData
|
|
18997
|
+
};
|
|
18998
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18988
18999
|
};
|
|
18989
19000
|
if (isLoading) {
|
|
18990
19001
|
return /* @__PURE__ */ jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
|
|
@@ -27368,7 +27379,8 @@ var init_DetailPanel = __esm({
|
|
|
27368
27379
|
return;
|
|
27369
27380
|
}
|
|
27370
27381
|
if (action.event) {
|
|
27371
|
-
|
|
27382
|
+
const payload = data2 ? { id: data2.id, row: data2 } : {};
|
|
27383
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
27372
27384
|
}
|
|
27373
27385
|
if (action.onClick) {
|
|
27374
27386
|
action.onClick();
|
|
@@ -28810,9 +28822,10 @@ var init_Form = __esm({
|
|
|
28810
28822
|
};
|
|
28811
28823
|
const handleSubmit = (e) => {
|
|
28812
28824
|
e.preventDefault();
|
|
28813
|
-
|
|
28825
|
+
const payload = { data: formData };
|
|
28826
|
+
eventBus.emit(`UI:${submitEvent}`, payload);
|
|
28814
28827
|
if (onSubmit) {
|
|
28815
|
-
eventBus.emit(`UI:${onSubmit}`,
|
|
28828
|
+
eventBus.emit(`UI:${onSubmit}`, payload);
|
|
28816
28829
|
}
|
|
28817
28830
|
};
|
|
28818
28831
|
const handleCancel = () => {
|
|
@@ -30180,6 +30193,31 @@ function normalizeFields2(fields) {
|
|
|
30180
30193
|
if (!fields) return [];
|
|
30181
30194
|
return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
|
|
30182
30195
|
}
|
|
30196
|
+
function entityFieldsFromListItem(item) {
|
|
30197
|
+
const {
|
|
30198
|
+
icon: _icon,
|
|
30199
|
+
metadata: _metadata,
|
|
30200
|
+
onClick: _onClick,
|
|
30201
|
+
avatar: _avatar,
|
|
30202
|
+
_fields,
|
|
30203
|
+
...rest
|
|
30204
|
+
} = item;
|
|
30205
|
+
const result = {};
|
|
30206
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
30207
|
+
if (typeof value === "function" || value !== null && typeof value === "object" && "$$typeof" in value) {
|
|
30208
|
+
continue;
|
|
30209
|
+
}
|
|
30210
|
+
result[key] = value;
|
|
30211
|
+
}
|
|
30212
|
+
if (_fields && typeof _fields === "object") {
|
|
30213
|
+
for (const [k, v] of Object.entries(_fields)) {
|
|
30214
|
+
if (typeof v !== "function") {
|
|
30215
|
+
result[k] = v;
|
|
30216
|
+
}
|
|
30217
|
+
}
|
|
30218
|
+
}
|
|
30219
|
+
return result;
|
|
30220
|
+
}
|
|
30183
30221
|
function getStatusStyle(fieldName, value) {
|
|
30184
30222
|
const val = String(value).toLowerCase();
|
|
30185
30223
|
if (val.includes("complete") || val.includes("done"))
|
|
@@ -30383,18 +30421,17 @@ var init_List = __esm({
|
|
|
30383
30421
|
label: action.label,
|
|
30384
30422
|
event: action.event,
|
|
30385
30423
|
onClick: () => {
|
|
30424
|
+
const row = entityFieldsFromListItem(item);
|
|
30386
30425
|
if (action.navigatesTo) {
|
|
30387
30426
|
const url = action.navigatesTo.replace(
|
|
30388
30427
|
/\{\{(\w+)\}\}/g,
|
|
30389
|
-
(_, key) => String(
|
|
30428
|
+
(_, key) => String(row[key] ?? item.id ?? "")
|
|
30390
30429
|
);
|
|
30391
|
-
eventBus.emit("UI:NAVIGATE", { url, row
|
|
30430
|
+
eventBus.emit("UI:NAVIGATE", { url, row });
|
|
30392
30431
|
return;
|
|
30393
30432
|
}
|
|
30394
30433
|
if (action.event) {
|
|
30395
|
-
eventBus.emit(`UI:${action.event}`, {
|
|
30396
|
-
row: item
|
|
30397
|
-
});
|
|
30434
|
+
eventBus.emit(`UI:${action.event}`, { row });
|
|
30398
30435
|
}
|
|
30399
30436
|
}
|
|
30400
30437
|
}));
|
|
@@ -30474,7 +30511,7 @@ var init_List = __esm({
|
|
|
30474
30511
|
);
|
|
30475
30512
|
const hasExplicitClick = !!(viewAction?.event || item.onClick);
|
|
30476
30513
|
const rowAction = viewAction?.event ?? "VIEW";
|
|
30477
|
-
const rowActionPayload = { row: item };
|
|
30514
|
+
const rowActionPayload = { row: entityFieldsFromListItem(item) };
|
|
30478
30515
|
const primaryField = effectiveFieldNames?.[0];
|
|
30479
30516
|
const statusField = effectiveFieldNames?.find(
|
|
30480
30517
|
(f3) => f3.toLowerCase().includes("status")
|
|
@@ -36309,16 +36346,19 @@ var init_Timeline = __esm({
|
|
|
36309
36346
|
] }),
|
|
36310
36347
|
item.description && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
|
|
36311
36348
|
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
|
-
|
|
36349
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) => {
|
|
36350
|
+
const { icon: _icon, ...rowSafe } = item;
|
|
36351
|
+
return /* @__PURE__ */ jsx(
|
|
36352
|
+
Box,
|
|
36353
|
+
{
|
|
36354
|
+
action: action.event,
|
|
36355
|
+
actionPayload: { row: rowSafe },
|
|
36356
|
+
className: "cursor-pointer hover:opacity-80 transition-opacity",
|
|
36357
|
+
children: /* @__PURE__ */ jsx(Badge, { variant: "default", children: action.label })
|
|
36358
|
+
},
|
|
36359
|
+
actionIdx
|
|
36360
|
+
);
|
|
36361
|
+
}) })
|
|
36322
36362
|
] })
|
|
36323
36363
|
] }, item.id);
|
|
36324
36364
|
}) })
|
|
@@ -38213,9 +38253,6 @@ function EventBusProvider({ children, debug: debug2 = false }) {
|
|
|
38213
38253
|
const emit = useCallback((type, payload, source) => {
|
|
38214
38254
|
const event = {
|
|
38215
38255
|
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
38256
|
payload,
|
|
38220
38257
|
timestamp: Date.now(),
|
|
38221
38258
|
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;
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -221,9 +221,6 @@ var init_useEventBus = __esm({
|
|
|
221
221
|
emit: (type, payload, source) => {
|
|
222
222
|
const event = {
|
|
223
223
|
type,
|
|
224
|
-
// Narrow at the bus boundary: public emit accepts an opaque object so
|
|
225
|
-
// generic UI emit sites don't require casts; the envelope stores the
|
|
226
|
-
// payload as EventPayload which listeners consume directly.
|
|
227
224
|
payload,
|
|
228
225
|
timestamp: Date.now(),
|
|
229
226
|
source
|
|
@@ -15798,7 +15795,11 @@ var init_CardGrid = __esm({
|
|
|
15798
15795
|
return;
|
|
15799
15796
|
}
|
|
15800
15797
|
if (action.event) {
|
|
15801
|
-
|
|
15798
|
+
const payload = {
|
|
15799
|
+
id: itemData.id,
|
|
15800
|
+
row: itemData
|
|
15801
|
+
};
|
|
15802
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
15802
15803
|
}
|
|
15803
15804
|
if (action.onClick) {
|
|
15804
15805
|
action.onClick(itemData);
|
|
@@ -18468,7 +18469,8 @@ var init_DataGrid = __esm({
|
|
|
18468
18469
|
if (next.has(id)) next.delete(id);
|
|
18469
18470
|
else next.add(id);
|
|
18470
18471
|
if (selectionEvent) {
|
|
18471
|
-
|
|
18472
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18473
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18472
18474
|
}
|
|
18473
18475
|
return next;
|
|
18474
18476
|
});
|
|
@@ -18479,7 +18481,8 @@ var init_DataGrid = __esm({
|
|
|
18479
18481
|
const allSelected2 = allIds2.length > 0 && allIds2.every((id) => prev.has(id));
|
|
18480
18482
|
const next = allSelected2 ? /* @__PURE__ */ new Set() : new Set(allIds2);
|
|
18481
18483
|
if (selectionEvent) {
|
|
18482
|
-
|
|
18484
|
+
const payload = { selectedIds: Array.from(next) };
|
|
18485
|
+
eventBus.emit(`UI:${selectionEvent}`, payload);
|
|
18483
18486
|
}
|
|
18484
18487
|
return next;
|
|
18485
18488
|
});
|
|
@@ -18491,7 +18494,11 @@ var init_DataGrid = __esm({
|
|
|
18491
18494
|
const dangerActions = itemActions?.filter((a) => a.variant === "danger") ?? [];
|
|
18492
18495
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18493
18496
|
e.stopPropagation();
|
|
18494
|
-
|
|
18497
|
+
const payload = {
|
|
18498
|
+
id: itemData.id,
|
|
18499
|
+
row: itemData
|
|
18500
|
+
};
|
|
18501
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18495
18502
|
};
|
|
18496
18503
|
const gridTemplateColumns = cols ? void 0 : `repeat(auto-fit, minmax(min(${minCardWidth}px, 100%), 1fr))`;
|
|
18497
18504
|
const colsClass = cols ? {
|
|
@@ -18819,7 +18826,11 @@ var init_DataList = __esm({
|
|
|
18819
18826
|
);
|
|
18820
18827
|
const handleActionClick = (action, itemData) => (e) => {
|
|
18821
18828
|
e.stopPropagation();
|
|
18822
|
-
|
|
18829
|
+
const payload = {
|
|
18830
|
+
id: itemData.id,
|
|
18831
|
+
row: itemData
|
|
18832
|
+
};
|
|
18833
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
18823
18834
|
};
|
|
18824
18835
|
if (isLoading) {
|
|
18825
18836
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "text-center py-8", children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", color: "secondary", children: t("loading.items") || "Loading..." }) });
|
|
@@ -27001,7 +27012,8 @@ var init_DetailPanel = __esm({
|
|
|
27001
27012
|
return;
|
|
27002
27013
|
}
|
|
27003
27014
|
if (action.event) {
|
|
27004
|
-
|
|
27015
|
+
const payload = data2 ? { id: data2.id, row: data2 } : {};
|
|
27016
|
+
eventBus.emit(`UI:${action.event}`, payload);
|
|
27005
27017
|
}
|
|
27006
27018
|
if (action.onClick) {
|
|
27007
27019
|
action.onClick();
|
|
@@ -28443,9 +28455,10 @@ var init_Form = __esm({
|
|
|
28443
28455
|
};
|
|
28444
28456
|
const handleSubmit = (e) => {
|
|
28445
28457
|
e.preventDefault();
|
|
28446
|
-
|
|
28458
|
+
const payload = { data: formData };
|
|
28459
|
+
eventBus.emit(`UI:${submitEvent}`, payload);
|
|
28447
28460
|
if (onSubmit) {
|
|
28448
|
-
eventBus.emit(`UI:${onSubmit}`,
|
|
28461
|
+
eventBus.emit(`UI:${onSubmit}`, payload);
|
|
28449
28462
|
}
|
|
28450
28463
|
};
|
|
28451
28464
|
const handleCancel = () => {
|
|
@@ -29813,6 +29826,31 @@ function normalizeFields2(fields) {
|
|
|
29813
29826
|
if (!fields) return [];
|
|
29814
29827
|
return fields.map((f3) => typeof f3 === "string" ? f3 : f3.key ?? f3.name ?? "");
|
|
29815
29828
|
}
|
|
29829
|
+
function entityFieldsFromListItem(item) {
|
|
29830
|
+
const {
|
|
29831
|
+
icon: _icon,
|
|
29832
|
+
metadata: _metadata,
|
|
29833
|
+
onClick: _onClick,
|
|
29834
|
+
avatar: _avatar,
|
|
29835
|
+
_fields,
|
|
29836
|
+
...rest
|
|
29837
|
+
} = item;
|
|
29838
|
+
const result = {};
|
|
29839
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
29840
|
+
if (typeof value === "function" || value !== null && typeof value === "object" && "$$typeof" in value) {
|
|
29841
|
+
continue;
|
|
29842
|
+
}
|
|
29843
|
+
result[key] = value;
|
|
29844
|
+
}
|
|
29845
|
+
if (_fields && typeof _fields === "object") {
|
|
29846
|
+
for (const [k, v] of Object.entries(_fields)) {
|
|
29847
|
+
if (typeof v !== "function") {
|
|
29848
|
+
result[k] = v;
|
|
29849
|
+
}
|
|
29850
|
+
}
|
|
29851
|
+
}
|
|
29852
|
+
return result;
|
|
29853
|
+
}
|
|
29816
29854
|
function getStatusStyle(fieldName, value) {
|
|
29817
29855
|
const val = String(value).toLowerCase();
|
|
29818
29856
|
if (val.includes("complete") || val.includes("done"))
|
|
@@ -30016,18 +30054,17 @@ var init_List = __esm({
|
|
|
30016
30054
|
label: action.label,
|
|
30017
30055
|
event: action.event,
|
|
30018
30056
|
onClick: () => {
|
|
30057
|
+
const row = entityFieldsFromListItem(item);
|
|
30019
30058
|
if (action.navigatesTo) {
|
|
30020
30059
|
const url = action.navigatesTo.replace(
|
|
30021
30060
|
/\{\{(\w+)\}\}/g,
|
|
30022
|
-
(_, key) => String(
|
|
30061
|
+
(_, key) => String(row[key] ?? item.id ?? "")
|
|
30023
30062
|
);
|
|
30024
|
-
eventBus.emit("UI:NAVIGATE", { url, row
|
|
30063
|
+
eventBus.emit("UI:NAVIGATE", { url, row });
|
|
30025
30064
|
return;
|
|
30026
30065
|
}
|
|
30027
30066
|
if (action.event) {
|
|
30028
|
-
eventBus.emit(`UI:${action.event}`, {
|
|
30029
|
-
row: item
|
|
30030
|
-
});
|
|
30067
|
+
eventBus.emit(`UI:${action.event}`, { row });
|
|
30031
30068
|
}
|
|
30032
30069
|
}
|
|
30033
30070
|
}));
|
|
@@ -30107,7 +30144,7 @@ var init_List = __esm({
|
|
|
30107
30144
|
);
|
|
30108
30145
|
const hasExplicitClick = !!(viewAction?.event || item.onClick);
|
|
30109
30146
|
const rowAction = viewAction?.event ?? "VIEW";
|
|
30110
|
-
const rowActionPayload = { row: item };
|
|
30147
|
+
const rowActionPayload = { row: entityFieldsFromListItem(item) };
|
|
30111
30148
|
const primaryField = effectiveFieldNames?.[0];
|
|
30112
30149
|
const statusField = effectiveFieldNames?.find(
|
|
30113
30150
|
(f3) => f3.toLowerCase().includes("status")
|
|
@@ -35926,16 +35963,19 @@ var init_Timeline = __esm({
|
|
|
35926
35963
|
] }),
|
|
35927
35964
|
item.description && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "small", color: "secondary", children: item.description }),
|
|
35928
35965
|
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)) }),
|
|
35929
|
-
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) =>
|
|
35930
|
-
|
|
35931
|
-
|
|
35932
|
-
|
|
35933
|
-
|
|
35934
|
-
|
|
35935
|
-
|
|
35936
|
-
|
|
35937
|
-
|
|
35938
|
-
|
|
35966
|
+
itemActions && itemActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", className: "mt-1", children: itemActions.map((action, actionIdx) => {
|
|
35967
|
+
const { icon: _icon, ...rowSafe } = item;
|
|
35968
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
35969
|
+
Box,
|
|
35970
|
+
{
|
|
35971
|
+
action: action.event,
|
|
35972
|
+
actionPayload: { row: rowSafe },
|
|
35973
|
+
className: "cursor-pointer hover:opacity-80 transition-opacity",
|
|
35974
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "default", children: action.label })
|
|
35975
|
+
},
|
|
35976
|
+
actionIdx
|
|
35977
|
+
);
|
|
35978
|
+
}) })
|
|
35939
35979
|
] })
|
|
35940
35980
|
] }, item.id);
|
|
35941
35981
|
}) })
|