@almadar/ui 5.132.0 → 5.133.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.
@@ -39011,7 +39011,17 @@ function DataTable({
39011
39011
  const currentPageSize = pageSize ?? 20;
39012
39012
  const total = totalCount ?? items.length;
39013
39013
  const totalPages = Math.ceil(total / currentPageSize);
39014
- const rowActions = externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
39014
+ const withEventClick = (action) => {
39015
+ if (action.onClick || !action.event) return action;
39016
+ const event = action.event;
39017
+ return {
39018
+ ...action,
39019
+ onClick: (row) => {
39020
+ eventBus.emit(`UI:${event}`, { row });
39021
+ }
39022
+ };
39023
+ };
39024
+ const rowActions = (externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
39015
39025
  label: action.label,
39016
39026
  icon: action.icon,
39017
39027
  variant: action.variant,
@@ -39031,7 +39041,17 @@ function DataTable({
39031
39041
  });
39032
39042
  }
39033
39043
  }
39034
- }));
39044
+ })))?.map(withEventClick);
39045
+ const normalizedBulkActions = bulkActions?.map((action) => {
39046
+ if (action.onClick || !action.event) return action;
39047
+ const event = action.event;
39048
+ return {
39049
+ ...action,
39050
+ onClick: (selectedRows2) => {
39051
+ eventBus.emit(`UI:${event}`, { rows: selectedRows2 });
39052
+ }
39053
+ };
39054
+ });
39035
39055
  const viewAction = itemActions?.find(
39036
39056
  (a) => a.event === "VIEW" || a.navigatesTo
39037
39057
  );
@@ -39139,7 +39159,7 @@ function DataTable({
39139
39159
  }
39140
39160
  )
39141
39161
  ] }),
39142
- bulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
39162
+ normalizedBulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
39143
39163
  /* @__PURE__ */ jsxRuntime.jsx(
39144
39164
  Typography,
39145
39165
  {
@@ -39150,13 +39170,13 @@ function DataTable({
39150
39170
  })
39151
39171
  }
39152
39172
  ),
39153
- /* @__PURE__ */ jsxRuntime.jsx(HStack, { className: "flex-wrap gap-2", children: bulkActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsx(
39173
+ /* @__PURE__ */ jsxRuntime.jsx(HStack, { className: "flex-wrap gap-2", children: normalizedBulkActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsx(
39154
39174
  Button,
39155
39175
  {
39156
39176
  variant: action.variant === "danger" ? "danger" : "secondary",
39157
39177
  size: "sm",
39158
39178
  leftIcon: action.icon,
39159
- onClick: () => action.onClick(selectedRows),
39179
+ onClick: () => action.onClick?.(selectedRows),
39160
39180
  children: action.label
39161
39181
  },
39162
39182
  idx
@@ -39318,7 +39338,7 @@ function DataTable({
39318
39338
  ),
39319
39339
  onClick: (e) => {
39320
39340
  e.stopPropagation();
39321
- action.onClick(row);
39341
+ action.onClick?.(row);
39322
39342
  setOpenActionMenu(null);
39323
39343
  },
39324
39344
  children: [
package/dist/avl/index.js CHANGED
@@ -38935,7 +38935,17 @@ function DataTable({
38935
38935
  const currentPageSize = pageSize ?? 20;
38936
38936
  const total = totalCount ?? items.length;
38937
38937
  const totalPages = Math.ceil(total / currentPageSize);
38938
- const rowActions = externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
38938
+ const withEventClick = (action) => {
38939
+ if (action.onClick || !action.event) return action;
38940
+ const event = action.event;
38941
+ return {
38942
+ ...action,
38943
+ onClick: (row) => {
38944
+ eventBus.emit(`UI:${event}`, { row });
38945
+ }
38946
+ };
38947
+ };
38948
+ const rowActions = (externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
38939
38949
  label: action.label,
38940
38950
  icon: action.icon,
38941
38951
  variant: action.variant,
@@ -38955,7 +38965,17 @@ function DataTable({
38955
38965
  });
38956
38966
  }
38957
38967
  }
38958
- }));
38968
+ })))?.map(withEventClick);
38969
+ const normalizedBulkActions = bulkActions?.map((action) => {
38970
+ if (action.onClick || !action.event) return action;
38971
+ const event = action.event;
38972
+ return {
38973
+ ...action,
38974
+ onClick: (selectedRows2) => {
38975
+ eventBus.emit(`UI:${event}`, { rows: selectedRows2 });
38976
+ }
38977
+ };
38978
+ });
38959
38979
  const viewAction = itemActions?.find(
38960
38980
  (a) => a.event === "VIEW" || a.navigatesTo
38961
38981
  );
@@ -39063,7 +39083,7 @@ function DataTable({
39063
39083
  }
39064
39084
  )
39065
39085
  ] }),
39066
- bulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
39086
+ normalizedBulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
39067
39087
  /* @__PURE__ */ jsx(
39068
39088
  Typography,
39069
39089
  {
@@ -39074,13 +39094,13 @@ function DataTable({
39074
39094
  })
39075
39095
  }
39076
39096
  ),
39077
- /* @__PURE__ */ jsx(HStack, { className: "flex-wrap gap-2", children: bulkActions.map((action, idx) => /* @__PURE__ */ jsx(
39097
+ /* @__PURE__ */ jsx(HStack, { className: "flex-wrap gap-2", children: normalizedBulkActions.map((action, idx) => /* @__PURE__ */ jsx(
39078
39098
  Button,
39079
39099
  {
39080
39100
  variant: action.variant === "danger" ? "danger" : "secondary",
39081
39101
  size: "sm",
39082
39102
  leftIcon: action.icon,
39083
- onClick: () => action.onClick(selectedRows),
39103
+ onClick: () => action.onClick?.(selectedRows),
39084
39104
  children: action.label
39085
39105
  },
39086
39106
  idx
@@ -39242,7 +39262,7 @@ function DataTable({
39242
39262
  ),
39243
39263
  onClick: (e) => {
39244
39264
  e.stopPropagation();
39245
- action.onClick(row);
39265
+ action.onClick?.(row);
39246
39266
  setOpenActionMenu(null);
39247
39267
  },
39248
39268
  children: [
@@ -38609,7 +38609,17 @@ function DataTable({
38609
38609
  const currentPageSize = pageSize ?? 20;
38610
38610
  const total = totalCount ?? items.length;
38611
38611
  const totalPages = Math.ceil(total / currentPageSize);
38612
- const rowActions = externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
38612
+ const withEventClick = (action) => {
38613
+ if (action.onClick || !action.event) return action;
38614
+ const event = action.event;
38615
+ return {
38616
+ ...action,
38617
+ onClick: (row) => {
38618
+ eventBus.emit(`UI:${event}`, { row });
38619
+ }
38620
+ };
38621
+ };
38622
+ const rowActions = (externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
38613
38623
  label: action.label,
38614
38624
  icon: action.icon,
38615
38625
  variant: action.variant,
@@ -38629,7 +38639,17 @@ function DataTable({
38629
38639
  });
38630
38640
  }
38631
38641
  }
38632
- }));
38642
+ })))?.map(withEventClick);
38643
+ const normalizedBulkActions = bulkActions?.map((action) => {
38644
+ if (action.onClick || !action.event) return action;
38645
+ const event = action.event;
38646
+ return {
38647
+ ...action,
38648
+ onClick: (selectedRows2) => {
38649
+ eventBus.emit(`UI:${event}`, { rows: selectedRows2 });
38650
+ }
38651
+ };
38652
+ });
38633
38653
  const viewAction = itemActions?.find(
38634
38654
  (a) => a.event === "VIEW" || a.navigatesTo
38635
38655
  );
@@ -38737,7 +38757,7 @@ function DataTable({
38737
38757
  }
38738
38758
  )
38739
38759
  ] }),
38740
- bulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
38760
+ normalizedBulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(exports.HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
38741
38761
  /* @__PURE__ */ jsxRuntime.jsx(
38742
38762
  exports.Typography,
38743
38763
  {
@@ -38748,13 +38768,13 @@ function DataTable({
38748
38768
  })
38749
38769
  }
38750
38770
  ),
38751
- /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { className: "flex-wrap gap-2", children: bulkActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsx(
38771
+ /* @__PURE__ */ jsxRuntime.jsx(exports.HStack, { className: "flex-wrap gap-2", children: normalizedBulkActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsx(
38752
38772
  exports.Button,
38753
38773
  {
38754
38774
  variant: action.variant === "danger" ? "danger" : "secondary",
38755
38775
  size: "sm",
38756
38776
  leftIcon: action.icon,
38757
- onClick: () => action.onClick(selectedRows),
38777
+ onClick: () => action.onClick?.(selectedRows),
38758
38778
  children: action.label
38759
38779
  },
38760
38780
  idx
@@ -38916,7 +38936,7 @@ function DataTable({
38916
38936
  ),
38917
38937
  onClick: (e) => {
38918
38938
  e.stopPropagation();
38919
- action.onClick(row);
38939
+ action.onClick?.(row);
38920
38940
  setOpenActionMenu(null);
38921
38941
  },
38922
38942
  children: [
@@ -9419,7 +9419,8 @@ interface Column<T> {
9419
9419
  interface RowAction<T> {
9420
9420
  label: string;
9421
9421
  icon?: IconInput;
9422
- onClick: (row: T) => void;
9422
+ /** Optional when `event` is set — a bus-emitting onClick is synthesized. */
9423
+ onClick?: (row: T) => void;
9423
9424
  variant?: "default" | "danger";
9424
9425
  show?: (row: T) => boolean;
9425
9426
  event?: string;
@@ -9459,8 +9460,10 @@ interface DataTableProps<T extends EntityRow & {
9459
9460
  bulkActions?: ReadonlyArray<{
9460
9461
  label: string;
9461
9462
  icon?: IconInput;
9462
- onClick: (selectedRows: T[]) => void;
9463
+ /** Optional when `event` is set — a bus-emitting onClick is synthesized. */
9464
+ onClick?: (selectedRows: T[]) => void;
9463
9465
  variant?: "default" | "danger";
9466
+ event?: string;
9464
9467
  }>;
9465
9468
  headerActions?: React__default.ReactNode;
9466
9469
  /** Show total count in pagination */
@@ -9419,7 +9419,8 @@ interface Column<T> {
9419
9419
  interface RowAction<T> {
9420
9420
  label: string;
9421
9421
  icon?: IconInput;
9422
- onClick: (row: T) => void;
9422
+ /** Optional when `event` is set — a bus-emitting onClick is synthesized. */
9423
+ onClick?: (row: T) => void;
9423
9424
  variant?: "default" | "danger";
9424
9425
  show?: (row: T) => boolean;
9425
9426
  event?: string;
@@ -9459,8 +9460,10 @@ interface DataTableProps<T extends EntityRow & {
9459
9460
  bulkActions?: ReadonlyArray<{
9460
9461
  label: string;
9461
9462
  icon?: IconInput;
9462
- onClick: (selectedRows: T[]) => void;
9463
+ /** Optional when `event` is set — a bus-emitting onClick is synthesized. */
9464
+ onClick?: (selectedRows: T[]) => void;
9463
9465
  variant?: "default" | "danger";
9466
+ event?: string;
9464
9467
  }>;
9465
9468
  headerActions?: React__default.ReactNode;
9466
9469
  /** Show total count in pagination */
@@ -38534,7 +38534,17 @@ function DataTable({
38534
38534
  const currentPageSize = pageSize ?? 20;
38535
38535
  const total = totalCount ?? items.length;
38536
38536
  const totalPages = Math.ceil(total / currentPageSize);
38537
- const rowActions = externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
38537
+ const withEventClick = (action) => {
38538
+ if (action.onClick || !action.event) return action;
38539
+ const event = action.event;
38540
+ return {
38541
+ ...action,
38542
+ onClick: (row) => {
38543
+ eventBus.emit(`UI:${event}`, { row });
38544
+ }
38545
+ };
38546
+ };
38547
+ const rowActions = (externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
38538
38548
  label: action.label,
38539
38549
  icon: action.icon,
38540
38550
  variant: action.variant,
@@ -38554,7 +38564,17 @@ function DataTable({
38554
38564
  });
38555
38565
  }
38556
38566
  }
38557
- }));
38567
+ })))?.map(withEventClick);
38568
+ const normalizedBulkActions = bulkActions?.map((action) => {
38569
+ if (action.onClick || !action.event) return action;
38570
+ const event = action.event;
38571
+ return {
38572
+ ...action,
38573
+ onClick: (selectedRows2) => {
38574
+ eventBus.emit(`UI:${event}`, { rows: selectedRows2 });
38575
+ }
38576
+ };
38577
+ });
38558
38578
  const viewAction = itemActions?.find(
38559
38579
  (a) => a.event === "VIEW" || a.navigatesTo
38560
38580
  );
@@ -38662,7 +38682,7 @@ function DataTable({
38662
38682
  }
38663
38683
  )
38664
38684
  ] }),
38665
- bulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
38685
+ normalizedBulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
38666
38686
  /* @__PURE__ */ jsx(
38667
38687
  Typography,
38668
38688
  {
@@ -38673,13 +38693,13 @@ function DataTable({
38673
38693
  })
38674
38694
  }
38675
38695
  ),
38676
- /* @__PURE__ */ jsx(HStack, { className: "flex-wrap gap-2", children: bulkActions.map((action, idx) => /* @__PURE__ */ jsx(
38696
+ /* @__PURE__ */ jsx(HStack, { className: "flex-wrap gap-2", children: normalizedBulkActions.map((action, idx) => /* @__PURE__ */ jsx(
38677
38697
  Button,
38678
38698
  {
38679
38699
  variant: action.variant === "danger" ? "danger" : "secondary",
38680
38700
  size: "sm",
38681
38701
  leftIcon: action.icon,
38682
- onClick: () => action.onClick(selectedRows),
38702
+ onClick: () => action.onClick?.(selectedRows),
38683
38703
  children: action.label
38684
38704
  },
38685
38705
  idx
@@ -38841,7 +38861,7 @@ function DataTable({
38841
38861
  ),
38842
38862
  onClick: (e) => {
38843
38863
  e.stopPropagation();
38844
- action.onClick(row);
38864
+ action.onClick?.(row);
38845
38865
  setOpenActionMenu(null);
38846
38866
  },
38847
38867
  children: [
@@ -37154,7 +37154,17 @@ function DataTable({
37154
37154
  const currentPageSize = pageSize ?? 20;
37155
37155
  const total = totalCount ?? items.length;
37156
37156
  const totalPages = Math.ceil(total / currentPageSize);
37157
- const rowActions = externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
37157
+ const withEventClick = (action) => {
37158
+ if (action.onClick || !action.event) return action;
37159
+ const event = action.event;
37160
+ return {
37161
+ ...action,
37162
+ onClick: (row) => {
37163
+ eventBus.emit(`UI:${event}`, { row });
37164
+ }
37165
+ };
37166
+ };
37167
+ const rowActions = (externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
37158
37168
  label: action.label,
37159
37169
  icon: action.icon,
37160
37170
  variant: action.variant,
@@ -37174,7 +37184,17 @@ function DataTable({
37174
37184
  });
37175
37185
  }
37176
37186
  }
37177
- }));
37187
+ })))?.map(withEventClick);
37188
+ const normalizedBulkActions = bulkActions?.map((action) => {
37189
+ if (action.onClick || !action.event) return action;
37190
+ const event = action.event;
37191
+ return {
37192
+ ...action,
37193
+ onClick: (selectedRows2) => {
37194
+ eventBus.emit(`UI:${event}`, { rows: selectedRows2 });
37195
+ }
37196
+ };
37197
+ });
37178
37198
  const viewAction = itemActions?.find(
37179
37199
  (a) => a.event === "VIEW" || a.navigatesTo
37180
37200
  );
@@ -37282,7 +37302,7 @@ function DataTable({
37282
37302
  }
37283
37303
  )
37284
37304
  ] }),
37285
- bulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
37305
+ normalizedBulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
37286
37306
  /* @__PURE__ */ jsxRuntime.jsx(
37287
37307
  Typography,
37288
37308
  {
@@ -37293,13 +37313,13 @@ function DataTable({
37293
37313
  })
37294
37314
  }
37295
37315
  ),
37296
- /* @__PURE__ */ jsxRuntime.jsx(HStack, { className: "flex-wrap gap-2", children: bulkActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsx(
37316
+ /* @__PURE__ */ jsxRuntime.jsx(HStack, { className: "flex-wrap gap-2", children: normalizedBulkActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsx(
37297
37317
  Button,
37298
37318
  {
37299
37319
  variant: action.variant === "danger" ? "danger" : "secondary",
37300
37320
  size: "sm",
37301
37321
  leftIcon: action.icon,
37302
- onClick: () => action.onClick(selectedRows),
37322
+ onClick: () => action.onClick?.(selectedRows),
37303
37323
  children: action.label
37304
37324
  },
37305
37325
  idx
@@ -37461,7 +37481,7 @@ function DataTable({
37461
37481
  ),
37462
37482
  onClick: (e) => {
37463
37483
  e.stopPropagation();
37464
- action.onClick(row);
37484
+ action.onClick?.(row);
37465
37485
  setOpenActionMenu(null);
37466
37486
  },
37467
37487
  children: [
@@ -37080,7 +37080,17 @@ function DataTable({
37080
37080
  const currentPageSize = pageSize ?? 20;
37081
37081
  const total = totalCount ?? items.length;
37082
37082
  const totalPages = Math.ceil(total / currentPageSize);
37083
- const rowActions = externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
37083
+ const withEventClick = (action) => {
37084
+ if (action.onClick || !action.event) return action;
37085
+ const event = action.event;
37086
+ return {
37087
+ ...action,
37088
+ onClick: (row) => {
37089
+ eventBus.emit(`UI:${event}`, { row });
37090
+ }
37091
+ };
37092
+ };
37093
+ const rowActions = (externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
37084
37094
  label: action.label,
37085
37095
  icon: action.icon,
37086
37096
  variant: action.variant,
@@ -37100,7 +37110,17 @@ function DataTable({
37100
37110
  });
37101
37111
  }
37102
37112
  }
37103
- }));
37113
+ })))?.map(withEventClick);
37114
+ const normalizedBulkActions = bulkActions?.map((action) => {
37115
+ if (action.onClick || !action.event) return action;
37116
+ const event = action.event;
37117
+ return {
37118
+ ...action,
37119
+ onClick: (selectedRows2) => {
37120
+ eventBus.emit(`UI:${event}`, { rows: selectedRows2 });
37121
+ }
37122
+ };
37123
+ });
37104
37124
  const viewAction = itemActions?.find(
37105
37125
  (a) => a.event === "VIEW" || a.navigatesTo
37106
37126
  );
@@ -37208,7 +37228,7 @@ function DataTable({
37208
37228
  }
37209
37229
  )
37210
37230
  ] }),
37211
- bulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
37231
+ normalizedBulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
37212
37232
  /* @__PURE__ */ jsx(
37213
37233
  Typography,
37214
37234
  {
@@ -37219,13 +37239,13 @@ function DataTable({
37219
37239
  })
37220
37240
  }
37221
37241
  ),
37222
- /* @__PURE__ */ jsx(HStack, { className: "flex-wrap gap-2", children: bulkActions.map((action, idx) => /* @__PURE__ */ jsx(
37242
+ /* @__PURE__ */ jsx(HStack, { className: "flex-wrap gap-2", children: normalizedBulkActions.map((action, idx) => /* @__PURE__ */ jsx(
37223
37243
  Button,
37224
37244
  {
37225
37245
  variant: action.variant === "danger" ? "danger" : "secondary",
37226
37246
  size: "sm",
37227
37247
  leftIcon: action.icon,
37228
- onClick: () => action.onClick(selectedRows),
37248
+ onClick: () => action.onClick?.(selectedRows),
37229
37249
  children: action.label
37230
37250
  },
37231
37251
  idx
@@ -37387,7 +37407,7 @@ function DataTable({
37387
37407
  ),
37388
37408
  onClick: (e) => {
37389
37409
  e.stopPropagation();
37390
- action.onClick(row);
37410
+ action.onClick?.(row);
37391
37411
  setOpenActionMenu(null);
37392
37412
  },
37393
37413
  children: [
@@ -36506,7 +36506,17 @@ function DataTable({
36506
36506
  const currentPageSize = pageSize ?? 20;
36507
36507
  const total = totalCount ?? items.length;
36508
36508
  const totalPages = Math.ceil(total / currentPageSize);
36509
- const rowActions = externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
36509
+ const withEventClick = (action) => {
36510
+ if (action.onClick || !action.event) return action;
36511
+ const event = action.event;
36512
+ return {
36513
+ ...action,
36514
+ onClick: (row) => {
36515
+ eventBus.emit(`UI:${event}`, { row });
36516
+ }
36517
+ };
36518
+ };
36519
+ const rowActions = (externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
36510
36520
  label: action.label,
36511
36521
  icon: action.icon,
36512
36522
  variant: action.variant,
@@ -36526,7 +36536,17 @@ function DataTable({
36526
36536
  });
36527
36537
  }
36528
36538
  }
36529
- }));
36539
+ })))?.map(withEventClick);
36540
+ const normalizedBulkActions = bulkActions?.map((action) => {
36541
+ if (action.onClick || !action.event) return action;
36542
+ const event = action.event;
36543
+ return {
36544
+ ...action,
36545
+ onClick: (selectedRows2) => {
36546
+ eventBus.emit(`UI:${event}`, { rows: selectedRows2 });
36547
+ }
36548
+ };
36549
+ });
36530
36550
  const viewAction = itemActions?.find(
36531
36551
  (a) => a.event === "VIEW" || a.navigatesTo
36532
36552
  );
@@ -36634,7 +36654,7 @@ function DataTable({
36634
36654
  }
36635
36655
  )
36636
36656
  ] }),
36637
- bulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
36657
+ normalizedBulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
36638
36658
  /* @__PURE__ */ jsxRuntime.jsx(
36639
36659
  Typography,
36640
36660
  {
@@ -36645,13 +36665,13 @@ function DataTable({
36645
36665
  })
36646
36666
  }
36647
36667
  ),
36648
- /* @__PURE__ */ jsxRuntime.jsx(HStack, { className: "flex-wrap gap-2", children: bulkActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsx(
36668
+ /* @__PURE__ */ jsxRuntime.jsx(HStack, { className: "flex-wrap gap-2", children: normalizedBulkActions.map((action, idx) => /* @__PURE__ */ jsxRuntime.jsx(
36649
36669
  Button,
36650
36670
  {
36651
36671
  variant: action.variant === "danger" ? "danger" : "secondary",
36652
36672
  size: "sm",
36653
36673
  leftIcon: action.icon,
36654
- onClick: () => action.onClick(selectedRows),
36674
+ onClick: () => action.onClick?.(selectedRows),
36655
36675
  children: action.label
36656
36676
  },
36657
36677
  idx
@@ -36813,7 +36833,7 @@ function DataTable({
36813
36833
  ),
36814
36834
  onClick: (e) => {
36815
36835
  e.stopPropagation();
36816
- action.onClick(row);
36836
+ action.onClick?.(row);
36817
36837
  setOpenActionMenu(null);
36818
36838
  },
36819
36839
  children: [
@@ -36432,7 +36432,17 @@ function DataTable({
36432
36432
  const currentPageSize = pageSize ?? 20;
36433
36433
  const total = totalCount ?? items.length;
36434
36434
  const totalPages = Math.ceil(total / currentPageSize);
36435
- const rowActions = externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
36435
+ const withEventClick = (action) => {
36436
+ if (action.onClick || !action.event) return action;
36437
+ const event = action.event;
36438
+ return {
36439
+ ...action,
36440
+ onClick: (row) => {
36441
+ eventBus.emit(`UI:${event}`, { row });
36442
+ }
36443
+ };
36444
+ };
36445
+ const rowActions = (externalRowActions ?? itemActions?.filter((a) => a.placement !== "bulk").map((action) => ({
36436
36446
  label: action.label,
36437
36447
  icon: action.icon,
36438
36448
  variant: action.variant,
@@ -36452,7 +36462,17 @@ function DataTable({
36452
36462
  });
36453
36463
  }
36454
36464
  }
36455
- }));
36465
+ })))?.map(withEventClick);
36466
+ const normalizedBulkActions = bulkActions?.map((action) => {
36467
+ if (action.onClick || !action.event) return action;
36468
+ const event = action.event;
36469
+ return {
36470
+ ...action,
36471
+ onClick: (selectedRows2) => {
36472
+ eventBus.emit(`UI:${event}`, { rows: selectedRows2 });
36473
+ }
36474
+ };
36475
+ });
36456
36476
  const viewAction = itemActions?.find(
36457
36477
  (a) => a.event === "VIEW" || a.navigatesTo
36458
36478
  );
@@ -36560,7 +36580,7 @@ function DataTable({
36560
36580
  }
36561
36581
  )
36562
36582
  ] }),
36563
- bulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
36583
+ normalizedBulkActions && selectedIds.length > 0 && /* @__PURE__ */ jsxs(HStack, { className: "items-center gap-2 pl-0 sm:pl-3 border-l-0 sm:border-l border-border", children: [
36564
36584
  /* @__PURE__ */ jsx(
36565
36585
  Typography,
36566
36586
  {
@@ -36571,13 +36591,13 @@ function DataTable({
36571
36591
  })
36572
36592
  }
36573
36593
  ),
36574
- /* @__PURE__ */ jsx(HStack, { className: "flex-wrap gap-2", children: bulkActions.map((action, idx) => /* @__PURE__ */ jsx(
36594
+ /* @__PURE__ */ jsx(HStack, { className: "flex-wrap gap-2", children: normalizedBulkActions.map((action, idx) => /* @__PURE__ */ jsx(
36575
36595
  Button,
36576
36596
  {
36577
36597
  variant: action.variant === "danger" ? "danger" : "secondary",
36578
36598
  size: "sm",
36579
36599
  leftIcon: action.icon,
36580
- onClick: () => action.onClick(selectedRows),
36600
+ onClick: () => action.onClick?.(selectedRows),
36581
36601
  children: action.label
36582
36602
  },
36583
36603
  idx
@@ -36739,7 +36759,7 @@ function DataTable({
36739
36759
  ),
36740
36760
  onClick: (e) => {
36741
36761
  e.stopPropagation();
36742
- action.onClick(row);
36762
+ action.onClick?.(row);
36743
36763
  setOpenActionMenu(null);
36744
36764
  },
36745
36765
  children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.132.0",
3
+ "version": "5.133.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -118,11 +118,11 @@
118
118
  "access": "public"
119
119
  },
120
120
  "dependencies": {
121
- "@almadar/core": "^10.38.0",
121
+ "@almadar/core": "^10.39.0",
122
122
  "@almadar/evaluator": "^2.37.0",
123
123
  "@almadar/logger": "^1.10.0",
124
124
  "@almadar/runtime": "^6.42.0",
125
- "@almadar/std": "^16.149.0",
125
+ "@almadar/std": "^16.150.0",
126
126
  "@almadar/syntax": "^1.13.0",
127
127
  "@dnd-kit/core": "^6.3.1",
128
128
  "@dnd-kit/sortable": "^10.0.0",