@asteby/metacore-runtime-react 50.1.0 → 51.0.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +26 -0
  3. package/dist/activity-timeline.d.ts.map +1 -1
  4. package/dist/activity-timeline.js +4 -2
  5. package/dist/audit-info.d.ts.map +1 -1
  6. package/dist/audit-info.js +3 -2
  7. package/dist/dialogs/dynamic-record.d.ts.map +1 -1
  8. package/dist/dialogs/dynamic-record.js +8 -5
  9. package/dist/dynamic-columns.d.ts +6 -0
  10. package/dist/dynamic-columns.d.ts.map +1 -1
  11. package/dist/dynamic-columns.js +30 -7
  12. package/dist/dynamic-kanban.js +6 -5
  13. package/dist/dynamic-table.d.ts.map +1 -1
  14. package/dist/dynamic-table.js +6 -4
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/org-runtime-context.d.ts +38 -0
  19. package/dist/org-runtime-context.d.ts.map +1 -1
  20. package/dist/org-runtime-context.js +18 -0
  21. package/dist/org-runtime-provider.d.ts +14 -1
  22. package/dist/org-runtime-provider.d.ts.map +1 -1
  23. package/dist/org-runtime-provider.js +3 -3
  24. package/dist/record-history.d.ts.map +1 -1
  25. package/dist/record-history.js +3 -1
  26. package/dist/row-actions-menu.d.ts +7 -1
  27. package/dist/row-actions-menu.d.ts.map +1 -1
  28. package/dist/row-actions-menu.js +3 -3
  29. package/dist/widgets/widget-card.d.ts +7 -2
  30. package/dist/widgets/widget-card.d.ts.map +1 -1
  31. package/dist/widgets/widget-card.js +6 -3
  32. package/package.json +3 -3
  33. package/src/__tests__/org-runtime-number-locale-system-actor.test.tsx +80 -0
  34. package/src/__tests__/secondary-actions.test.tsx +19 -0
  35. package/src/activity-timeline.tsx +4 -2
  36. package/src/audit-info.tsx +3 -2
  37. package/src/dialogs/dynamic-record.tsx +8 -5
  38. package/src/dynamic-columns.tsx +54 -6
  39. package/src/dynamic-kanban.tsx +6 -5
  40. package/src/dynamic-table.tsx +6 -4
  41. package/src/index.ts +1 -0
  42. package/src/org-runtime-context.ts +56 -0
  43. package/src/org-runtime-provider.tsx +29 -3
  44. package/src/record-history.tsx +3 -1
  45. package/src/row-actions-menu.tsx +14 -3
  46. package/src/widgets/widget-card.tsx +26 -3
@@ -30,3 +30,21 @@ export const useCurrency = () => useContext(CurrencyContext);
30
30
  export const TaxRateContext = createContext(undefined);
31
31
  /** Reads the nearest org default tax rate (undefined outside a provider). */
32
32
  export const useOrgTaxRate = () => useContext(TaxRateContext);
33
+ export const NumberLocalesContext = createContext(undefined);
34
+ /**
35
+ * Pure resolver: the Intl locale numbers should use for `language` given the
36
+ * org's overrides. Returns `language` unchanged when nothing matches.
37
+ */
38
+ export function resolveNumberLocale(language, locales) {
39
+ if (!language || !locales)
40
+ return language;
41
+ const lower = language.toLowerCase();
42
+ const byKey = new Map(Object.entries(locales).map(([k, v]) => [k.toLowerCase(), v]));
43
+ return byKey.get(lower) ?? byKey.get(lower.split('-')[0]) ?? language;
44
+ }
45
+ export function useNumberLocale(language) {
46
+ return resolveNumberLocale(language, useContext(NumberLocalesContext));
47
+ }
48
+ export const SystemActorContext = createContext(undefined);
49
+ /** Reads the nearest system-actor presentation (undefined outside a provider). */
50
+ export const useSystemActor = () => useContext(SystemActorContext);
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type GetImageUrl } from './image-url-context';
3
+ import { type NumberLocales, type SystemActor } from './org-runtime-context';
3
4
  export interface OrgRuntimeProviderProps {
4
5
  /** Org IANA timezone (e.g. `America/Mexico_City`). */
5
6
  timeZone?: string;
@@ -7,9 +8,21 @@ export interface OrgRuntimeProviderProps {
7
8
  currency?: string;
8
9
  /** Org default tax rate as a fraction (e.g. `0.16`) for document lines. */
9
10
  taxRate?: number;
11
+ /**
12
+ * Number-locale overrides by UI language, e.g. `{ es: 'es-MX' }` so a
13
+ * Spanish UI formats numbers and money as Mexico does (11,461.50). Applies
14
+ * to table cells and footers, kanban cards and lane totals, and the record
15
+ * dialog. Omit to format with the UI language as-is.
16
+ */
17
+ numberLocales?: NumberLocales;
18
+ /**
19
+ * Presentation of the system actor (name + avatar) wherever a record shows
20
+ * who created/changed it and nobody did — e.g. `{ name: 'Gobi' }`.
21
+ */
22
+ systemActor?: SystemActor;
10
23
  /** Resolver turning a stored path into a fetchable URL. Defaults to identity. */
11
24
  getImageUrl?: GetImageUrl;
12
25
  children: ReactNode;
13
26
  }
14
- export declare function OrgRuntimeProvider({ timeZone, currency, taxRate, getImageUrl, children, }: OrgRuntimeProviderProps): import("react").JSX.Element;
27
+ export declare function OrgRuntimeProvider({ timeZone, currency, taxRate, numberLocales, systemActor, getImageUrl, children, }: OrgRuntimeProviderProps): import("react").JSX.Element;
15
28
  //# sourceMappingURL=org-runtime-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"org-runtime-provider.d.ts","sourceRoot":"","sources":["../src/org-runtime-provider.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAA;AAG5B,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iFAAiF;IACjF,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAA8B,EAC9B,QAAQ,GACT,EAAE,uBAAuB,+BAYzB"}
1
+ {"version":3,"file":"org-runtime-provider.d.ts","sourceRoot":"","sources":["../src/org-runtime-provider.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,iFAAiF;IACjF,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,aAAa,EACb,WAAW,EACX,WAA8B,EAC9B,QAAQ,GACT,EAAE,uBAAuB,+BAgBzB"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ImageUrlContext, identityImageUrl, } from './image-url-context';
3
- import { CurrencyContext, TaxRateContext, TimeZoneContext } from './org-runtime-context';
4
- export function OrgRuntimeProvider({ timeZone, currency, taxRate, getImageUrl = identityImageUrl, children, }) {
5
- return (_jsx(ImageUrlContext.Provider, { value: getImageUrl, children: _jsx(TimeZoneContext.Provider, { value: timeZone, children: _jsx(CurrencyContext.Provider, { value: currency, children: _jsx(TaxRateContext.Provider, { value: taxRate, children: children }) }) }) }));
3
+ import { CurrencyContext, NumberLocalesContext, SystemActorContext, TaxRateContext, TimeZoneContext, } from './org-runtime-context';
4
+ export function OrgRuntimeProvider({ timeZone, currency, taxRate, numberLocales, systemActor, getImageUrl = identityImageUrl, children, }) {
5
+ return (_jsx(ImageUrlContext.Provider, { value: getImageUrl, children: _jsx(TimeZoneContext.Provider, { value: timeZone, children: _jsx(CurrencyContext.Provider, { value: currency, children: _jsx(TaxRateContext.Provider, { value: taxRate, children: _jsx(NumberLocalesContext.Provider, { value: numberLocales, children: _jsx(SystemActorContext.Provider, { value: systemActor, children: children }) }) }) }) }) }));
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"record-history.d.ts","sourceRoot":"","sources":["../src/record-history.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAe9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAOpD,MAAM,WAAW,kBAAkB;IAC/B;;;OAGG;IACH,MAAM,EAAE,aAAa,EAAE,CAAA;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAC5C;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IAC3C;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACvB;AAoCD;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsLtD,CAAA"}
1
+ {"version":3,"file":"record-history.d.ts","sourceRoot":"","sources":["../src/record-history.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAgB9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAOpD,MAAM,WAAW,kBAAkB;IAC/B;;;OAGG;IACH,MAAM,EAAE,aAAa,EAAE,CAAA;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAC5C;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IAC3C;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACvB;AAoCD;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAuLtD,CAAA"}
@@ -11,6 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  * Transport-agnostic: events and column metadata arrive via props. No fetching.
12
12
  */
13
13
  import * as React from 'react';
14
+ import { useSystemActor } from './org-runtime-context';
14
15
  import { formatDistanceToNow } from 'date-fns';
15
16
  import { es, enUS } from 'date-fns/locale';
16
17
  import { ChevronDown, ChevronRight, Clock, ExternalLink } from 'lucide-react';
@@ -54,6 +55,7 @@ function actionDotColor(action) {
54
55
  export const RecordHistory = ({ events, columns, timeZone, currency, locale = 'es', className, onOpenEvent, resolveAvatarUrl, moduleLabel, }) => {
55
56
  const dateLocale = locale === 'en' ? enUS : es;
56
57
  // Sort: most recent first
58
+ const systemName = useSystemActor()?.name || 'Sistema';
57
59
  const sorted = React.useMemo(() => [...events].sort((a, b) => new Date(b.occurred_at).getTime() - new Date(a.occurred_at).getTime()), [events]);
58
60
  // Expand the most-recent event by default
59
61
  const [openIds, setOpenIds] = React.useState(() => sorted.length > 0 ? new Set([sorted[0].id]) : new Set());
@@ -73,7 +75,7 @@ export const RecordHistory = ({ events, columns, timeZone, currency, locale = 'e
73
75
  return (_jsxs("div", { className: cn('relative pl-5', className), children: [_jsx("span", { className: "absolute left-2 top-2 bottom-2 w-px bg-border", "aria-hidden": "true" }), _jsx("div", { className: "space-y-3", children: sorted.map((event) => {
74
76
  const isOpen = openIds.has(event.id);
75
77
  const dotColor = actionDotColor(event.action);
76
- const actor = event.actor_label || event.actor_id || 'Sistema';
78
+ const actor = event.actor_label || event.actor_id || systemName;
77
79
  const timeAgo = (() => {
78
80
  try {
79
81
  return formatDistanceToNow(new Date(event.occurred_at), { addSuffix: true, locale: dateLocale });
@@ -21,6 +21,12 @@ export interface RowActionsMenuProps {
21
21
  /** Sustituye el ícono del disparador (p. ej. un spinner mientras imprime). */
22
22
  triggerIcon?: React.ReactNode;
23
23
  disabled?: boolean;
24
+ /**
25
+ * Agrupa las acciones secundarias en un submenú «Más…» (por defecto). Con
26
+ * `false` todas se listan en el primer nivel: las secundarias van después
27
+ * de un separador, sin submenú.
28
+ */
29
+ groupSecondary?: boolean;
24
30
  }
25
31
  /**
26
32
  * Modelo de las filas que pinta la tabla. DynamicTable lo provee: la factoría
@@ -28,5 +34,5 @@ export interface RowActionsMenuProps {
28
34
  * para resolver las acciones aportadas por addons.
29
35
  */
30
36
  export declare const RowActionsModelContext: React.Context<string | undefined>;
31
- export declare function RowActionsMenu({ actions, row, model, onAction, triggerIcon, disabled }: RowActionsMenuProps): React.JSX.Element | null;
37
+ export declare function RowActionsMenu({ actions, row, model, onAction, triggerIcon, disabled, groupSecondary }: RowActionsMenuProps): React.JSX.Element | null;
32
38
  //# sourceMappingURL=row-actions-menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"row-actions-menu.d.ts","sourceRoot":"","sources":["../src/row-actions-menu.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAqB9B;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAC9B,MAAM,EACN,KAAK,EACL,QAAQ,EACR,SAAS,GACZ,EAAE;IACC,MAAM,EAAE,GAAG,CAAA;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAA;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,qBAgBA;AAED,MAAM,WAAW,mBAAmB;IAChC,yEAAyE;IACzE,OAAO,EAAE,GAAG,EAAE,CAAA;IACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACxB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;IAChD,8EAA8E;IAC9E,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,mCAAqD,CAAA;AAMxF,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,mBAAmB,4BAwE3G"}
1
+ {"version":3,"file":"row-actions-menu.d.ts","sourceRoot":"","sources":["../src/row-actions-menu.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAqB9B;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAC9B,MAAM,EACN,KAAK,EACL,QAAQ,EACR,SAAS,GACZ,EAAE;IACC,MAAM,EAAE,GAAG,CAAA;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAA;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,qBAgBA;AAED,MAAM,WAAW,mBAAmB;IAChC,yEAAyE;IACzE,OAAO,EAAE,GAAG,EAAE,CAAA;IACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACxB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;IAChD,8EAA8E;IAC9E,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,mCAAqD,CAAA;AAMxF,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAqB,EAAE,EAAE,mBAAmB,4BA6ElI"}
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  // RowActionsMenu — el «…» de una fila: la acción primaria (si hay) arriba y
3
3
  // destacada, las principales debajo y las secundarias (compartir, imprimir,
4
4
  // correo, chat, PDF/XML y lo que aporten addons vía registerRecordAction)
5
- // agrupadas en un «Más…» discreto. Una acción por capacidad sin proveedor
5
+ // agrupadas en un «Más…» discreto (o en el primer nivel con groupSecondary={false}). Una acción por capacidad sin proveedor
6
6
  // activo, o una contribución cuyo addon no está instalado, no aparece.
7
7
  //
8
8
  // DynamicTable lo usa por defecto (getDynamicColumns) y los hosts que arman su
@@ -34,7 +34,7 @@ export function RowActionMenuItem({ action, label, onSelect, className, }) {
34
34
  * para resolver las acciones aportadas por addons.
35
35
  */
36
36
  export const RowActionsModelContext = React.createContext(undefined);
37
- export function RowActionsMenu({ actions, row, model, onAction, triggerIcon, disabled }) {
37
+ export function RowActionsMenu({ actions, row, model, onAction, triggerIcon, disabled, groupSecondary = true }) {
38
38
  const { t } = useTranslation();
39
39
  const installed = useInstalledAddons();
40
40
  const ctxModel = React.useContext(RowActionsModelContext);
@@ -53,7 +53,7 @@ export function RowActionsMenu({ actions, row, model, onAction, triggerIcon, dis
53
53
  const renderEntry = (e) => e.kind === 'action' ? (_jsx(RowActionMenuItem, { action: e.action, label: translateMetadataLabel(e.action.label, t), onSelect: () => onAction?.(e.action.key, row) }, e.action.key)) : (_jsxs(DropdownMenuItem, { "data-action": e.item.key, onClick: () => void e.item.run?.(), children: [_jsx(DynamicIcon, { name: e.item.icon || 'Share2', className: "mr-2 h-4 w-4" }), t(e.item.label, { defaultValue: e.item.label })] }, e.item.key));
54
54
  const hasMain = !!primary || mainEntries.length > 0;
55
55
  const moreLabel = t('datatable.more_actions', { defaultValue: 'Más…' });
56
- return (_jsx("div", { className: "flex items-center justify-end", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", className: "h-8 w-8 p-0", disabled: disabled, onClick: (e) => e.stopPropagation(), children: [_jsx("span", { className: "sr-only", children: t('datatable.open_menu', { defaultValue: 'Abrir menú' }) }), triggerIcon ?? _jsx(MoreHorizontal, { className: "h-4 w-4" })] }) }), _jsxs(DropdownMenuContent, { align: "end", onClick: (e) => e.stopPropagation(), children: [primary ? (_jsx(RowActionMenuItem, { action: primary, label: translateMetadataLabel(primary.label, t), onSelect: () => onAction?.(primary.key, row), className: "font-semibold" })) : null, mainEntries.map(renderEntry), secondaryEntries.length > 0 && hasMain ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { "data-row-more": "", className: "text-muted-foreground", children: moreLabel }), _jsx(DropdownMenuSubContent, { "data-row-secondary": "", children: secondaryEntries.map(renderEntry) })] })] })) : (
56
+ return (_jsx("div", { className: "flex items-center justify-end", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", className: "h-8 w-8 p-0", disabled: disabled, onClick: (e) => e.stopPropagation(), children: [_jsx("span", { className: "sr-only", children: t('datatable.open_menu', { defaultValue: 'Abrir menú' }) }), triggerIcon ?? _jsx(MoreHorizontal, { className: "h-4 w-4" })] }) }), _jsxs(DropdownMenuContent, { align: "end", onClick: (e) => e.stopPropagation(), children: [primary ? (_jsx(RowActionMenuItem, { action: primary, label: translateMetadataLabel(primary.label, t), onSelect: () => onAction?.(primary.key, row), className: "font-semibold" })) : null, mainEntries.map(renderEntry), secondaryEntries.length > 0 && hasMain && !groupSecondary ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), secondaryEntries.map(renderEntry)] })) : secondaryEntries.length > 0 && hasMain ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { "data-row-more": "", className: "text-muted-foreground", children: moreLabel }), _jsx(DropdownMenuSubContent, { "data-row-secondary": "", children: secondaryEntries.map(renderEntry) })] })] })) : (
57
57
  // Sin principales no hay con qué competir: lista plana.
58
58
  secondaryEntries.map(renderEntry))] })] }) }));
59
59
  }
@@ -27,8 +27,13 @@ export declare function DeltaChip({ delta, text }: {
27
27
  export declare function WidgetEmpty({ message }: {
28
28
  message: string;
29
29
  }): React.JSX.Element;
30
- /** Per-widget error state — isolated so a broken widget never tumbles the grid. */
31
- export declare function WidgetError({ message }: {
30
+ /**
31
+ * Per-widget error state — isolated so a broken widget never tumbles the grid.
32
+ * Pass `onRetry` to offer a retry (e.g. the widget query's `refetch`).
33
+ */
34
+ export declare function WidgetError({ message, onRetry, retryLabel, }: {
32
35
  message: string;
36
+ onRetry?: () => void;
37
+ retryLabel?: string;
33
38
  }): React.JSX.Element;
34
39
  //# sourceMappingURL=widget-card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"widget-card.d.ts","sourceRoot":"","sources":["../../src/widgets/widget-card.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,qDAAqD;IACrD,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,oBAAoB;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wCAAwC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,WAAW,EACX,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACV,EAAE,eAAe,qBA6CjB;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,qBAiBzE;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,qBAM3D;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,qBAO3D"}
1
+ {"version":3,"file":"widget-card.d.ts","sourceRoot":"","sources":["../../src/widgets/widget-card.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,qDAAqD;IACrD,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,oBAAoB;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wCAAwC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,WAAW,EACX,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACV,EAAE,eAAe,qBA6CjB;AAED,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,qBAiBzE;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,qBAM3D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EACxB,OAAO,EACP,OAAO,EACP,UAAyB,GAC5B,EAAE;IACC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB,qBAmBA"}
@@ -24,7 +24,10 @@ export function DeltaChip({ delta, text }) {
24
24
  export function WidgetEmpty({ message }) {
25
25
  return (_jsx("div", { className: "flex flex-1 items-center justify-center py-6 text-center text-xs text-muted-foreground", children: message }));
26
26
  }
27
- /** Per-widget error state — isolated so a broken widget never tumbles the grid. */
28
- export function WidgetError({ message }) {
29
- return (_jsxs("div", { className: "flex flex-1 items-center justify-center gap-2 py-6 text-center text-xs text-destructive", children: [_jsx(DynamicIcon, { name: "TriangleAlert", className: "size-4" }), _jsx("span", { children: message })] }));
27
+ /**
28
+ * Per-widget error state — isolated so a broken widget never tumbles the grid.
29
+ * Pass `onRetry` to offer a retry (e.g. the widget query's `refetch`).
30
+ */
31
+ export function WidgetError({ message, onRetry, retryLabel = 'Reintentar', }) {
32
+ return (_jsxs("div", { role: "alert", className: "flex flex-1 flex-wrap items-center justify-center gap-2 py-6 text-center text-xs text-destructive", children: [_jsx(DynamicIcon, { name: "TriangleAlert", className: "size-4" }), _jsx("span", { children: message }), onRetry && (_jsx("button", { type: "button", onClick: onRetry, className: "rounded-md border px-2 py-0.5 font-medium text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: retryLabel }))] }));
30
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteby/metacore-runtime-react",
3
- "version": "50.1.0",
3
+ "version": "51.0.0",
4
4
  "description": "React runtime for metacore hosts — renders addon contributions dynamically",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@asteby/metacore-sdk": "^3.14.0",
29
- "@asteby/metacore-ui": "^2.25.0",
29
+ "@asteby/metacore-ui": "^2.27.0",
30
30
  "@tanstack/react-query": ">=5",
31
31
  "@tanstack/react-router": ">=1.100",
32
32
  "@tanstack/react-table": ">=8",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@asteby/metacore-sdk": "3.14.0",
57
- "@asteby/metacore-ui": "2.25.0",
57
+ "@asteby/metacore-ui": "2.27.0",
58
58
  "@tanstack/react-query": "^5.95.0",
59
59
  "@tanstack/react-router": "^1.168.0",
60
60
  "@tanstack/react-table": "^8.20.0",
@@ -0,0 +1,80 @@
1
+ // @vitest-environment happy-dom
2
+ // OrgRuntimeProvider `numberLocales` (es → es-MX) and `systemActor`
3
+ // (presentable name/avatar for records the system created or changed).
4
+ import { afterEach, describe, expect, it, vi } from 'vitest'
5
+ import { cleanup, fireEvent, render, renderHook, screen } from '@testing-library/react'
6
+ import type { ReactNode } from 'react'
7
+
8
+ vi.mock('react-i18next', () => {
9
+ const t = (k: string, o?: { defaultValue?: string; who?: string }) =>
10
+ (o?.defaultValue ?? k).replace('{{who}}', o?.who ?? '')
11
+ return { useTranslation: () => ({ t, i18n: { language: 'es' } }) }
12
+ })
13
+
14
+ import { OrgRuntimeProvider } from '../org-runtime-provider'
15
+ import { resolveNumberLocale, useNumberLocale, useSystemActor } from '../org-runtime-context'
16
+ import { isSystemActorColumn } from '../dynamic-columns'
17
+ import { AuditInfo, SYSTEM_ACTOR_ID } from '../audit-info'
18
+
19
+ afterEach(cleanup)
20
+
21
+ describe('resolveNumberLocale', () => {
22
+ it('maps by full language, then base, case-insensitive', () => {
23
+ expect(resolveNumberLocale('es', { es: 'es-MX' })).toBe('es-MX')
24
+ expect(resolveNumberLocale('ES', { es: 'es-MX' })).toBe('es-MX')
25
+ expect(resolveNumberLocale('es-AR', { es: 'es-MX' })).toBe('es-MX')
26
+ expect(resolveNumberLocale('es-AR', { es: 'es-MX', 'es-ar': 'es-AR' })).toBe('es-AR')
27
+ })
28
+
29
+ it('leaves unmatched languages and missing config untouched', () => {
30
+ expect(resolveNumberLocale('en', { es: 'es-MX' })).toBe('en')
31
+ expect(resolveNumberLocale('es', undefined)).toBe('es')
32
+ expect(resolveNumberLocale(undefined, { es: 'es-MX' })).toBeUndefined()
33
+ })
34
+
35
+ it('es-MX formats thousands the Mexican way (vs bare es)', () => {
36
+ const mx = new Intl.NumberFormat(resolveNumberLocale('es', { es: 'es-MX' })).format(11461.5)
37
+ expect(mx).toBe('11,461.5')
38
+ })
39
+ })
40
+
41
+ describe('OrgRuntimeProvider contexts', () => {
42
+ const wrap =
43
+ (props: Record<string, unknown>) =>
44
+ ({ children }: { children: ReactNode }) => <OrgRuntimeProvider {...props}>{children}</OrgRuntimeProvider>
45
+
46
+ it('useNumberLocale reads numberLocales; defaults to the language', () => {
47
+ expect(renderHook(() => useNumberLocale('es'), { wrapper: wrap({ numberLocales: { es: 'es-MX' } }) }).result.current).toBe('es-MX')
48
+ expect(renderHook(() => useNumberLocale('es')).result.current).toBe('es')
49
+ })
50
+
51
+ it('useSystemActor reads systemActor; undefined outside a provider', () => {
52
+ const actor = { name: 'Gobi', avatarUrl: '/brand/gobi.png' }
53
+ expect(renderHook(() => useSystemActor(), { wrapper: wrap({ systemActor: actor }) }).result.current).toEqual(actor)
54
+ expect(renderHook(() => useSystemActor()).result.current).toBeUndefined()
55
+ })
56
+ })
57
+
58
+ describe('isSystemActorColumn', () => {
59
+ it('creator and created_by.* are system columns; plain people are not', () => {
60
+ expect(isSystemActorColumn('creator', 'owner', 'owner.name')).toBe(true)
61
+ expect(isSystemActorColumn('avatar', 'created_by.avatar', 'created_by.name')).toBe(true)
62
+ expect(isSystemActorColumn('user', 'assignee', 'assignee.name')).toBe(false)
63
+ })
64
+ })
65
+
66
+ describe('<AuditInfo> with systemActor', () => {
67
+ it('names the configured system actor instead of "Sistema"', () => {
68
+ render(
69
+ <OrgRuntimeProvider systemActor={{ name: 'Gobi' }}>
70
+ <AuditInfo
71
+ record={{ created_at: '2026-01-01T10:00:00Z', created_by_id: SYSTEM_ACTOR_ID }}
72
+ audit={{ created_at: 'created_at', created_by: 'created_by_id' }}
73
+ timeZone="UTC"
74
+ />
75
+ </OrgRuntimeProvider>,
76
+ )
77
+ fireEvent.click(screen.getByRole('button'))
78
+ expect(screen.getByText('Creado por Gobi')).toBeTruthy()
79
+ })
80
+ })
@@ -129,6 +129,25 @@ describe('RowActionsMenu', () => {
129
129
  expect(screen.getByText('Enviar al chat')).toBeTruthy()
130
130
  })
131
131
 
132
+ it('con groupSecondary={false} todas las acciones salen en el primer nivel, sin «Más…»', async () => {
133
+ const run = shareToChat()
134
+ render(
135
+ <InstalledAddonsProvider addons={['link']}>
136
+ <RowActionsMenu actions={ACTIONS} row={ROW} model="Invoice" groupSecondary={false} />
137
+ </InstalledAddonsProvider>,
138
+ )
139
+ await openMenu()
140
+ const top = [...document.querySelectorAll('[role="menu"] > [role="menuitem"]')].map(
141
+ (el) => el.getAttribute('data-action') ?? el.textContent,
142
+ )
143
+ expect(top).toEqual(['stamp', 'cancel', 'approve', 'send_cfdi_email', 'reprint_cfdi', 'team_chat.share'])
144
+ expect(screen.queryByText('Más…')).toBeNull()
145
+ await act(async () => {
146
+ fireEvent.click(screen.getByText('Enviar al chat'))
147
+ })
148
+ expect(run).toHaveBeenCalledWith({ model: 'Invoice', record: ROW })
149
+ })
150
+
132
151
  it('primaria única destacada; las secundarias van bajo «Más…», no en el primer nivel', async () => {
133
152
  const run = shareToChat()
134
153
  render(
@@ -14,6 +14,7 @@
14
14
  */
15
15
 
16
16
  import * as React from 'react'
17
+ import { useSystemActor } from './org-runtime-context'
17
18
  import { formatDistanceToNow } from 'date-fns'
18
19
  import { es, enUS } from 'date-fns/locale'
19
20
  import type { Locale } from 'date-fns'
@@ -201,7 +202,8 @@ const GroupCard: React.FC<GroupCardProps> = ({
201
202
  }) => {
202
203
  const { root, events, changedFieldCount } = group
203
204
  const isMulti = events.length > 1
204
- const actor = root.actor_label || root.actor_id || 'Sistema'
205
+ const systemName = useSystemActor()?.name || 'Sistema'
206
+ const actor = root.actor_label || root.actor_id || systemName
205
207
  const dotColor = actionDotColor(root.action)
206
208
 
207
209
  const timeAgo = (() => {
@@ -294,7 +296,7 @@ const GroupCard: React.FC<GroupCardProps> = ({
294
296
  <div className="border-t border-border/40 divide-y divide-border/30">
295
297
  {events.map((ev, idx) => {
296
298
  const cols = resolveColumns(ev.model)
297
- const evActor = ev.actor_label || ev.actor_id || 'Sistema'
299
+ const evActor = ev.actor_label || ev.actor_id || systemName
298
300
  return (
299
301
  <div key={ev.id} className="px-4 py-3 space-y-2">
300
302
  {/* Show sub-actor + model when group has multiple events */}
@@ -24,7 +24,7 @@ import { cn } from '@asteby/metacore-ui/lib'
24
24
  import { formatDateCell } from './dynamic-columns'
25
25
  import { objectLabel } from './dynamic-relation-helpers'
26
26
  import { isNilUuid } from './nil-uuid'
27
- import { useTimeZone } from './org-runtime-context'
27
+ import { useSystemActor, useTimeZone } from './org-runtime-context'
28
28
  import type { AuditMeta } from './types'
29
29
 
30
30
  /** The kernel's actor for unattended work (schedules, webhooks, connectors). */
@@ -145,6 +145,7 @@ export function AuditInfo({
145
145
  }: AuditInfoProps) {
146
146
  const { t, i18n } = useTranslation()
147
147
  const ctxTz = useTimeZone()
148
+ const systemActor = useSystemActor()
148
149
  const [open, setOpen] = React.useState(defaultOpen)
149
150
 
150
151
  const meta = readAuditMeta(audit)
@@ -166,7 +167,7 @@ export function AuditInfo({
166
167
  ): Line | null => {
167
168
  const f = atCol ? formatDateCell(record[atCol], undefined, dfLocale, tz) : null
168
169
  if (!f) return null
169
- const actor = resolveAuditActor(record, byCol, { resolveActor, systemLabel: tt('system') })
170
+ const actor = resolveAuditActor(record, byCol, { resolveActor, systemLabel: systemActor?.name || tt('system') })
170
171
  const date = new Date(record[atCol as string] as string)
171
172
  const relative = formatDistanceToNow(date, { addSuffix: true, locale: dfLocale })
172
173
  return {
@@ -88,7 +88,7 @@ import { CollectionCell, type ItemField } from '../collection-cell'
88
88
  import type { ActionFieldDef, RelationMeta } from '../types'
89
89
  import { ImageUrlContext, identityImageUrl, type GetImageUrl } from '../image-url-context'
90
90
  import { getFieldWidget, useFieldWidgetRegistryVersion } from '../field-widget-registry'
91
- import { TimeZoneContext, CurrencyContext } from '../org-runtime-context'
91
+ import { TimeZoneContext, CurrencyContext, useNumberLocale, useSystemActor } from '../org-runtime-context'
92
92
 
93
93
  // Re-export the resolver type so `index.ts`'s
94
94
  // `export type { … GetImageUrl } from './dialogs/dynamic-record'` keeps working.
@@ -1706,6 +1706,8 @@ export function ViewValue({
1706
1706
  currency?: string
1707
1707
  }) {
1708
1708
  const { t, i18n } = useTranslation()
1709
+ const numberLocale = useNumberLocale(i18n.language)
1710
+ const systemActor = useSystemActor()
1709
1711
  const ctxImageUrl = useContext(ImageUrlContext)
1710
1712
  const ctxTimeZone = useContext(TimeZoneContext)
1711
1713
  const ctxCurrency = useContext(CurrencyContext)
@@ -1748,7 +1750,7 @@ export function ViewValue({
1748
1750
  (typeof field.key === 'string' && field.key.startsWith('created_by.')) ||
1749
1751
  renderAs === 'creator'
1750
1752
  if (isCreatedBy) {
1751
- return <p className="text-sm py-1">Sistema</p>
1753
+ return <p className="text-sm py-1">{systemActor?.name || t('common.system', { defaultValue: 'Sistema' })}</p>
1752
1754
  }
1753
1755
  return <p className="text-sm py-1 text-muted-foreground">—</p>
1754
1756
  }
@@ -1897,7 +1899,7 @@ export function ViewValue({
1897
1899
  const num = typeof value === 'number' ? value : Number(value)
1898
1900
  if (!isNaN(num)) {
1899
1901
  const resolvedCurrency = field.styleConfig?.currency || currency || 'USD'
1900
- const localeTag = i18n.language || 'es'
1902
+ const localeTag = numberLocale || 'es'
1901
1903
  const formatted = new Intl.NumberFormat(localeTag, {
1902
1904
  style: 'currency',
1903
1905
  currency: resolvedCurrency,
@@ -1988,7 +1990,7 @@ export function ViewValue({
1988
1990
  <StructuredViewValue
1989
1991
  value={value}
1990
1992
  field={field}
1991
- locale={i18n.language}
1993
+ locale={numberLocale}
1992
1994
  t={t}
1993
1995
  />
1994
1996
  )
@@ -2221,6 +2223,7 @@ export function EditField({ field, value, onChange, record, invalid, error }: {
2221
2223
  : undefined
2222
2224
 
2223
2225
  const { t, i18n } = useTranslation()
2226
+ const numberLocale = useNumberLocale(i18n.language)
2224
2227
  const editFieldImageUrl = useContext(ImageUrlContext)
2225
2228
  const dialogModel = useContext(RecordDialogModelContext)
2226
2229
 
@@ -2252,7 +2255,7 @@ export function EditField({ field, value, onChange, record, invalid, error }: {
2252
2255
  value={value}
2253
2256
  itemFields={fieldItemFields(field)}
2254
2257
  variant="inline"
2255
- locale={i18n.language}
2258
+ locale={numberLocale}
2256
2259
  t={t}
2257
2260
  getImageUrl={editFieldImageUrl}
2258
2261
  />
@@ -38,6 +38,7 @@ import {
38
38
  relationChipStyles,
39
39
  } from '@asteby/metacore-ui/lib'
40
40
  import { Progress } from './dialogs/_primitives'
41
+ import { useSystemActor } from './org-runtime-context'
41
42
  import { humanizeToken, translateMetadataLabel } from './dynamic-columns-helpers'
42
43
  import { objectLabel } from './dynamic-relation-helpers'
43
44
  import {
@@ -604,19 +605,33 @@ export function resolveMissingActorLabel(
604
605
  namePath: string | undefined,
605
606
  t?: (key: string, options?: { defaultValue?: string }) => string,
606
607
  ): string {
608
+ if (isSystemActorColumn(renderAs, colKey, namePath)) {
609
+ return t ? t('common.system', { defaultValue: 'Sistema' }) : 'Sistema'
610
+ }
611
+ return 'N/A'
612
+ }
613
+
614
+ /**
615
+ * True when an EMPTY actor in this cell means "the system did it": `creator`
616
+ * cells and `created_by.*` columns. Exported so hosts and renderers share the
617
+ * rule with resolveMissingActorLabel.
618
+ */
619
+ export function isSystemActorColumn(
620
+ renderAs: string | undefined,
621
+ colKey: string | undefined,
622
+ namePath: string | undefined,
623
+ ): boolean {
607
624
  const path = namePath || ''
608
625
  const key = colKey || ''
609
- const isCreatedByColumn =
626
+ return (
627
+ renderAs === 'creator' ||
610
628
  key === 'created_by' ||
611
629
  key === 'created_by_id' ||
612
630
  key.startsWith('created_by.') ||
613
631
  path === 'created_by' ||
614
632
  path === 'created_by.name' ||
615
633
  path.startsWith('created_by.')
616
- if (renderAs === 'creator' || isCreatedByColumn) {
617
- return t ? t('common.system', { defaultValue: 'Sistema' }) : 'Sistema'
618
- }
619
- return 'N/A'
634
+ )
620
635
  }
621
636
 
622
637
  /**
@@ -866,6 +881,27 @@ const AvatarCell: React.FC<{
866
881
  </div>
867
882
  )
868
883
 
884
+ /**
885
+ * Avatar cell for the system actor: the OrgRuntimeProvider `systemActor`
886
+ * name/avatar when set, else the localized fallback label with initials.
887
+ */
888
+ const identityUrl = (p: string) => p
889
+ const SystemActorCell: React.FC<{
890
+ fallbackName: string
891
+ desc?: string
892
+ getImageUrl: (path: string) => string
893
+ }> = ({ fallbackName, desc, getImageUrl }) => {
894
+ const actor = useSystemActor()
895
+ return (
896
+ <AvatarCell
897
+ name={actor?.name || fallbackName}
898
+ desc={desc}
899
+ avatarSrc={actor?.avatarUrl}
900
+ getImageUrl={actor?.avatarUrl ? identityUrl : getImageUrl}
901
+ />
902
+ )
903
+ }
904
+
869
905
  /**
870
906
  * Builds the canonical column factory used by `<DynamicTable>` when the host
871
907
  * does not supply its own. Pass `{ getImageUrl, apiBaseUrl }` to wire avatar
@@ -934,7 +970,9 @@ export function makeDefaultGetDynamicColumns(
934
970
  currency?: string,
935
971
  rowActionPredicate?: RowActionPredicate,
936
972
  ): ColumnDef<any>[] {
937
- const dateLocale = currentLanguage === 'en' ? enUS : es
973
+ // currentLanguage may be a regional number locale (es-MX, en-US) when
974
+ // the host sets OrgRuntimeProvider numberLocales; dates key off its base.
975
+ const dateLocale = currentLanguage?.toLowerCase().startsWith('en') ? enUS : es
938
976
  const columns: ColumnDef<any>[] = [
939
977
  {
940
978
  id: 'select',
@@ -1186,6 +1224,16 @@ export function makeDefaultGetDynamicColumns(
1186
1224
  resolveMissingActorLabel(renderAs, col.key, namePath, t)
1187
1225
  const desc = getNestedValue(row.original, col.description || '')
1188
1226
 
1227
+ if (!resolvedName && isSystemActorColumn(renderAs, col.key, namePath)) {
1228
+ return (
1229
+ <SystemActorCell
1230
+ fallbackName={String(name)}
1231
+ desc={desc ? String(desc) : undefined}
1232
+ getImageUrl={getImageUrl}
1233
+ />
1234
+ )
1235
+ }
1236
+
1189
1237
  const avatarSrc = resolveAvatarSrc(col, row.original, value, apiBaseUrl)
1190
1238
 
1191
1239
  return (
@@ -37,7 +37,7 @@ import {
37
37
  useSyncExternalStore,
38
38
  } from 'react'
39
39
  import { useTranslation } from 'react-i18next'
40
- import { useTimeZone, useCurrency } from './org-runtime-context'
40
+ import { useTimeZone, useCurrency, useNumberLocale } from './org-runtime-context'
41
41
  import {
42
42
  QueryClient,
43
43
  QueryClientContext,
@@ -950,6 +950,7 @@ function DynamicKanbanBoard({
950
950
  groupBy: groupByProp,
951
951
  }: DynamicKanbanProps) {
952
952
  const { t, i18n } = useTranslation()
953
+ const numberLocale = useNumberLocale(i18n.language)
953
954
  // The org's timezone/currency: an explicit prop wins, else the app-wide
954
955
  // OrgRuntimeProvider (without it, money fell back to USD).
955
956
  const orgTimeZone = useTimeZone()
@@ -2096,7 +2097,7 @@ function DynamicKanbanBoard({
2096
2097
  col,
2097
2098
  (laneSums[col.key] ?? 0) + (delta?.sums[col.key] ?? 0),
2098
2099
  currency,
2099
- i18n.language,
2100
+ numberLocale,
2100
2101
  ),
2101
2102
  }))
2102
2103
  : []
@@ -2160,7 +2161,7 @@ function DynamicKanbanBoard({
2160
2161
  actions={rowActions}
2161
2162
  stageField={lifecycleStageField(metadata)}
2162
2163
  rowActionPredicate={rowActionPredicate}
2163
- locale={i18n.language}
2164
+ locale={numberLocale}
2164
2165
  timeZone={timeZone}
2165
2166
  currency={currency}
2166
2167
  onClick={onCardClick}
@@ -2194,7 +2195,7 @@ function DynamicKanbanBoard({
2194
2195
  actions={rowActions}
2195
2196
  stageField={lifecycleStageField(metadata)}
2196
2197
  rowActionPredicate={rowActionPredicate}
2197
- locale={i18n.language}
2198
+ locale={numberLocale}
2198
2199
  timeZone={timeZone}
2199
2200
  currency={currency}
2200
2201
  onClick={onCardClick}
@@ -2404,7 +2405,7 @@ function DynamicKanbanBoard({
2404
2405
  titleCol={titleCol}
2405
2406
  fieldCols={fieldCols}
2406
2407
  showAllFields={explicitCard}
2407
- locale={i18n.language}
2408
+ locale={numberLocale}
2408
2409
  timeZone={timeZone}
2409
2410
  currency={currency}
2410
2411
  blocked={overBlocked}