@asteby/metacore-runtime-react 18.20.0 → 18.21.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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @asteby/metacore-runtime-react
2
2
 
3
+ ## 18.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 53950ed: CollectionCell renders jsonb line-items from a declared sub-field schema when
8
+ the column carries one (`col.itemFields` / snake `col.item_fields`, kernel v3
9
+ `item_fields`). Headers use the schema's already-localized `label` verbatim (in
10
+ the declared order, no prettify/translate); `ref` columns resolve to the
11
+ backend-injected sibling label — the FK key without `_id` (`product_id` →
12
+ `product`), else `<key>_label` — showing the resolved name instead of the raw
13
+ uuid (`{ value, label }` → `label`, bare string → itself, missing → truncated
14
+ uuid fallback). The badge count noun stays locale-aware. When no schema is
15
+ present the generic dict/prettify behaviour is unchanged. `itemFields` is
16
+ threaded from the dynamic columns factory callsite.
17
+
3
18
  ## 18.20.0
4
19
 
5
20
  ### Minor Changes
@@ -1,6 +1,24 @@
1
1
  import * as React from 'react';
2
2
  /** Host i18n translator (react-i18next `t`), as threaded into the columns factory. */
3
3
  export type Translate = (key: string, options?: any) => string;
4
+ /**
5
+ * Declared schema for one column of a jsonb line-items array. Mirrors the
6
+ * kernel v3 `item_fields` entry the backend serves on the column metadata
7
+ * (`col.itemFields` / snake `col.item_fields`). When present it drives the
8
+ * popover mini-table: headers come from `label` (already LOCALIZED by the
9
+ * backend — never re-translated here) and `ref` columns resolve to the
10
+ * backend-injected sibling label instead of the raw uuid.
11
+ */
12
+ export interface ItemField {
13
+ /** jsonb key this column maps to (e.g. `product_id`, `quantity`). */
14
+ key: string;
15
+ /** Header text — ALREADY localized by the backend. Used verbatim. */
16
+ label: string;
17
+ /** Declarative cell type hint (informational; not branched on today). */
18
+ type?: string;
19
+ /** FK target model. When set, the cell renders the resolved sibling label. */
20
+ ref?: string;
21
+ }
4
22
  /**
5
23
  * Localized key label for a popover column header. Resolution order:
6
24
  * (a) host i18n `t(rawKey)` if it resolves to something ≠ rawKey;
@@ -30,10 +48,19 @@ export interface CollectionCellProps {
30
48
  locale?: string;
31
49
  /** Host i18n translator; takes precedence over the built-in dictionary. */
32
50
  t?: Translate;
51
+ /**
52
+ * Declared schema for the jsonb line-items columns (kernel v3 `item_fields`,
53
+ * read from `col.itemFields ?? col.item_fields` at the callsite). When
54
+ * present AND the value is an array of objects, the popover mini-table uses
55
+ * these (already-localized) headers in order and resolves `ref` columns to
56
+ * the backend-injected sibling label. Absent → the generic dict/prettify
57
+ * behaviour is unchanged.
58
+ */
59
+ itemFields?: ItemField[];
33
60
  }
34
61
  /**
35
62
  * Generic renderer for jsonb / array / object cell values. Brand-neutral,
36
63
  * compact, dark-mode friendly, locale-aware. Never throws on unexpected shapes.
37
64
  */
38
- export declare function CollectionCell({ value, maxInline, locale, t, }: CollectionCellProps): React.JSX.Element;
65
+ export declare function CollectionCell({ value, maxInline, locale, t, itemFields, }: CollectionCellProps): React.JSX.Element;
39
66
  //# sourceMappingURL=collection-cell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collection-cell.d.ts","sourceRoot":"","sources":["../src/collection-cell.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAoB9B,sFAAsF;AACtF,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,MAAM,CAAA;AAiE9D;;;;;;GAMG;AACH,wBAAgB,WAAW,CACvB,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,EACf,CAAC,CAAC,EAAE,SAAS,GACd,MAAM,CAWR;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,EACf,CAAC,CAAC,EAAE,SAAS,GACd,MAAM,CAcR;AAED;;;;;;GAMG;AACH,wB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B;IAChC,KAAK,EAAE,OAAO,CAAA;IACd,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2EAA2E;IAC3E,CAAC,CAAC,EAAE,SAAS,CAAA;IACb;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,SAAS,EAAE,CAAA;CAC3B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,SAAa,EACb,MAAM,EACN,CAAC,EACD,UAAU,GACb,EAAE,mBAAmB,qBAoGrB"}
@@ -3,6 +3,36 @@ import { List } from 'lucide-react';
3
3
  import { Badge, Popover, PopoverContent, PopoverTrigger, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, cn, } from '@asteby/metacore-ui';
4
4
  import { humanizeToken } from './dynamic-columns-helpers';
5
5
  const UUID_LIKE_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
6
+ /**
7
+ * Resolves the backend-injected resolved sibling key for a ref item-field,
8
+ * mirroring `relationKeyFor` in dynamic-columns: the raw key with a trailing
9
+ * `_id` stripped (`product_id` → `product`), else `<key>_label`.
10
+ */
11
+ function siblingKeyFor(key) {
12
+ return key.endsWith('_id') ? key.slice(0, -3) : `${key}_label`;
13
+ }
14
+ /**
15
+ * Renders the cell value for one declared item-field of a jsonb row. For a
16
+ * `ref` field it prefers the backend-injected resolved sibling (the FK key
17
+ * without `_id`, else `<key>_label`): a `{ value, label }` object shows its
18
+ * `label`, a bare string shows itself; absent → the raw value via
19
+ * `formatScalar` (truncated uuid). Non-ref fields render `formatScalar(value)`.
20
+ */
21
+ function renderItemFieldValue(field, row) {
22
+ if (field.ref) {
23
+ const sibling = row[siblingKeyFor(field.key)];
24
+ if (sibling && typeof sibling === 'object' && !Array.isArray(sibling)) {
25
+ const label = sibling.label;
26
+ if (label !== undefined && label !== null && label !== '') {
27
+ return String(label);
28
+ }
29
+ }
30
+ else if (typeof sibling === 'string' && sibling !== '') {
31
+ return sibling;
32
+ }
33
+ }
34
+ return formatScalar(row[field.key]);
35
+ }
6
36
  /** Normalize an org/UI language tag to a base language code (`es-MX` → `es`). */
7
37
  function baseLang(locale) {
8
38
  return (locale || 'en').toLowerCase().split('-')[0];
@@ -164,7 +194,15 @@ function unionKeys(rows) {
164
194
  return seen;
165
195
  }
166
196
  const PANEL_CLASS = 'w-auto max-w-[480px] max-h-[320px] overflow-auto p-0';
167
- function MiniTable({ rows, locale, t, }) {
197
+ function MiniTable({ rows, locale, t, itemFields, }) {
198
+ // Schema-driven path: a declared `item_fields` schema fixes the column
199
+ // order + headers (already localized by the backend, used VERBATIM) and
200
+ // resolves ref columns to the injected sibling label instead of the raw
201
+ // uuid. Sibling/raw keys not covered by the schema are dropped from the
202
+ // table (the schema is the source of truth for what to surface).
203
+ if (itemFields && itemFields.length > 0) {
204
+ return (_jsxs(Table, { children: [_jsx(TableHeader, { children: _jsx(TableRow, { children: itemFields.map((field) => (_jsx(TableHead, { className: "text-xs whitespace-nowrap", children: field.label }, field.key))) }) }), _jsx(TableBody, { children: rows.map((row, i) => (_jsx(TableRow, { children: itemFields.map((field) => (_jsx(TableCell, { className: "text-xs whitespace-nowrap", children: renderItemFieldValue(field, row) }, field.key))) }, i))) })] }));
205
+ }
168
206
  const keys = unionKeys(rows);
169
207
  if (keys.length === 0) {
170
208
  return _jsx("div", { className: "p-3 text-xs text-muted-foreground", children: "-" });
@@ -185,7 +223,7 @@ function PopoverShell({ label, title, children, icon = true, }) {
185
223
  * Generic renderer for jsonb / array / object cell values. Brand-neutral,
186
224
  * compact, dark-mode friendly, locale-aware. Never throws on unexpected shapes.
187
225
  */
188
- export function CollectionCell({ value, maxInline = 3, locale, t, }) {
226
+ export function CollectionCell({ value, maxInline = 3, locale, t, itemFields, }) {
189
227
  const parsed = parseValue(value);
190
228
  // Empty-ish → muted dash.
191
229
  if (parsed === null ||
@@ -207,12 +245,22 @@ export function CollectionCell({ value, maxInline = 3, locale, t, }) {
207
245
  const rows = parsed;
208
246
  const count = rows.length;
209
247
  const label = countLabel(count, locale, t);
210
- const title = rows
211
- .map((row) => Object.entries(row)
212
- .map(([k, v]) => `${prettifyKey(k, locale, t)}: ${formatScalar(v)}`)
213
- .join(', '))
214
- .join(' | ');
215
- return (_jsx(PopoverShell, { label: label, title: title, children: _jsx(MiniTable, { rows: rows, locale: locale, t: t }) }));
248
+ const hasSchema = !!(itemFields && itemFields.length > 0);
249
+ // The no-JS tooltip mirrors the rendered table: schema-driven
250
+ // labels + resolved ref values when a schema is present, else the
251
+ // generic prettify/scalar pairs.
252
+ const title = hasSchema
253
+ ? rows
254
+ .map((row) => itemFields
255
+ .map((field) => `${field.label}: ${renderItemFieldValue(field, row)}`)
256
+ .join(', '))
257
+ .join(' | ')
258
+ : rows
259
+ .map((row) => Object.entries(row)
260
+ .map(([k, v]) => `${prettifyKey(k, locale, t)}: ${formatScalar(v)}`)
261
+ .join(', '))
262
+ .join(' | ');
263
+ return (_jsx(PopoverShell, { label: label, title: title, children: _jsx(MiniTable, { rows: rows, locale: locale, t: t, itemFields: itemFields }) }));
216
264
  }
217
265
  // Array of scalars (or mixed): preview first N joined, "+N" overflow.
218
266
  const preview = parsed.slice(0, maxInline).map(formatScalar).join(', ');
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-columns.d.ts","sourceRoot":"","sources":["../src/dynamic-columns.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAiC9C,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE9D,OAAO,KAAK,EAER,iBAAiB,EACpB,MAAM,wBAAwB,CAAA;AAE/B,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACtC;;;;OAI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IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA6C5C;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,gBAAgB,EAAE,KAAK,GAAG,KAAG,MAWtE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,gBAAgB,EAAE,KAAK,GAAG,KAAG,MAOtE,CAAA;AAsID;;;;GAIG;AACH,wBAAgB,4BAA4B,CACxC,OAAO,GAAE,qBAA0B,GACpC,iBAAiB,CA8nBnB;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,iBACL,CAAA"}
@@ -736,7 +736,7 @@ export function makeDefaultGetDynamicColumns(helpers = {}) {
736
736
  }
737
737
  default: {
738
738
  if (typeof value === 'object' && value !== null) {
739
- return (_jsx(CollectionCell, { value: value, locale: currentLanguage, t: t }));
739
+ return (_jsx(CollectionCell, { value: value, locale: currentLanguage, t: t, itemFields: col.itemFields ?? col.item_fields }));
740
740
  }
741
741
  if (col.key === 'description' ||
742
742
  col.key === 'features' ||
package/dist/types.d.ts CHANGED
@@ -137,6 +137,32 @@ export interface ColumnDefinition {
137
137
  * reference resolved through the OrgConfigProvider.
138
138
  */
139
139
  validation?: FieldValidation;
140
+ /**
141
+ * Declared schema for a jsonb line-items column (kernel v3 `item_fields`).
142
+ * Each entry describes one sub-field of the array's row objects: a `key`
143
+ * (the jsonb key), an already-LOCALIZED `label` (backend-translated), an
144
+ * optional `type` hint and an optional `ref` (FK target). When present the
145
+ * `CollectionCell` renders the popover mini-table with these headers in
146
+ * order and resolves `ref` columns to the backend-injected sibling label
147
+ * (the FK key without `_id`, else `<key>_label`) instead of the raw uuid.
148
+ * Tolerates the snake_case `item_fields` the kernel serves.
149
+ */
150
+ itemFields?: ColumnItemField[];
151
+ /** snake_case alias served by the kernel for `itemFields`. */
152
+ item_fields?: ColumnItemField[];
153
+ }
154
+ /**
155
+ * One declared sub-field of a jsonb line-items column (see
156
+ * `ColumnDefinition.itemFields`). `label` is already localized by the backend
157
+ * and consumed verbatim; a non-empty `ref` flags the column for resolved-label
158
+ * rendering against the injected sibling. Structurally compatible with the
159
+ * `ItemField` consumed by `collection-cell`.
160
+ */
161
+ export interface ColumnItemField {
162
+ key: string;
163
+ label: string;
164
+ type?: string;
165
+ ref?: string;
140
166
  }
141
167
  export interface ActionCondition {
142
168
  field: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,UAAU,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,YAAY,EAAE,CAAA;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IACzB,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAA;IACZ,kEAAkE;IAClE,IAAI,EAAE,aAAa,GAAG,cAAc,CAAA;IACpC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAA;IACnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,mCAA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
3
- "version": "18.20.0",
3
+ "version": "18.21.0",
4
4
  "description": "React runtime for metacore hosts — renders addon contributions dynamically",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  // - locale-aware: count noun + header keys render in the org language; the
10
10
  // host `t` overrides; unknown keys fall back to snake→Title prettify.
11
11
  import { afterEach, describe, expect, it } from 'vitest'
12
- import { cleanup, render, screen } from '@testing-library/react'
12
+ import { cleanup, fireEvent, render, screen } from '@testing-library/react'
13
13
 
14
14
  // Sin `globals: true` en vitest, RTL no auto-limpia entre tests.
15
15
  afterEach(cleanup)
@@ -176,3 +176,156 @@ describe('CollectionCell', () => {
176
176
  expect(container.textContent).toContain('{not valid json')
177
177
  })
178
178
  })
179
+
180
+ describe('CollectionCell with itemFields schema', () => {
181
+ const itemFields = [
182
+ { key: 'product_id', label: 'Producto', ref: 'Product' },
183
+ { key: 'quantity', label: 'Cantidad' },
184
+ ]
185
+
186
+ // The popover mini-table mounts lazily — open it by clicking the count
187
+ // badge (Radix opens on pointerDown + click under happy-dom).
188
+ const openPopover = (badgeText: string) => {
189
+ const badge = screen.getByText(badgeText)
190
+ fireEvent.pointerDown(badge)
191
+ fireEvent.click(badge)
192
+ return badge
193
+ }
194
+
195
+ it('uses the schema labels verbatim as headers (no prettify/dict)', () => {
196
+ render(
197
+ <CollectionCell
198
+ locale="es"
199
+ itemFields={itemFields}
200
+ value={[
201
+ {
202
+ product_id: '550e8400-e29b-41d4-a716-446655440000',
203
+ product: { value: '550e8400-e29b-41d4-a716-446655440000', label: 'Llanta 195/65' },
204
+ quantity: 2,
205
+ },
206
+ ]}
207
+ />
208
+ )
209
+ openPopover('1 ítem')
210
+ // Headers come from the schema `label` verbatim.
211
+ expect(screen.getByRole('columnheader', { name: 'Producto' })).toBeTruthy()
212
+ expect(screen.getByRole('columnheader', { name: 'Cantidad' })).toBeTruthy()
213
+ })
214
+
215
+ it('resolves a ref field to the injected sibling label, not the uuid', () => {
216
+ render(
217
+ <CollectionCell
218
+ itemFields={itemFields}
219
+ value={[
220
+ {
221
+ product_id: '550e8400-e29b-41d4-a716-446655440000',
222
+ product: { value: '550e8400-e29b-41d4-a716-446655440000', label: 'Llanta 195/65' },
223
+ quantity: 2,
224
+ },
225
+ ]}
226
+ />
227
+ )
228
+ openPopover('1 item')
229
+ expect(screen.getByRole('cell', { name: 'Llanta 195/65' })).toBeTruthy()
230
+ // The raw uuid (truncated form) must NOT appear in any cell.
231
+ expect(screen.queryByText('550e8400…')).toBeNull()
232
+ })
233
+
234
+ it('resolves a ref field from a `<key>_label` sibling when key has no _id suffix', () => {
235
+ render(
236
+ <CollectionCell
237
+ itemFields={[{ key: 'product', label: 'Producto', ref: 'Product' }]}
238
+ value={[
239
+ {
240
+ product: '550e8400-e29b-41d4-a716-446655440000',
241
+ product_label: { value: '550e8400-e29b-41d4-a716-446655440000', label: 'Balanceo' },
242
+ },
243
+ ]}
244
+ />
245
+ )
246
+ openPopover('1 item')
247
+ expect(screen.getByRole('cell', { name: 'Balanceo' })).toBeTruthy()
248
+ })
249
+
250
+ it('accepts a bare string sibling for a ref field', () => {
251
+ render(
252
+ <CollectionCell
253
+ itemFields={[{ key: 'product_id', label: 'Producto', ref: 'Product' }]}
254
+ value={[{ product_id: 'x', product: 'Aceite 5W30' }]}
255
+ />
256
+ )
257
+ openPopover('1 item')
258
+ expect(screen.getByRole('cell', { name: 'Aceite 5W30' })).toBeTruthy()
259
+ })
260
+
261
+ it('falls back to a truncated uuid when the ref sibling is missing', () => {
262
+ render(
263
+ <CollectionCell
264
+ itemFields={[{ key: 'product_id', label: 'Producto', ref: 'Product' }]}
265
+ value={[{ product_id: '550e8400-e29b-41d4-a716-446655440000' }]}
266
+ />
267
+ )
268
+ openPopover('1 item')
269
+ expect(screen.getByRole('cell', { name: '550e8400…' })).toBeTruthy()
270
+ })
271
+
272
+ it('keeps the locale-aware count noun on the badge', () => {
273
+ render(
274
+ <CollectionCell
275
+ locale="es"
276
+ itemFields={itemFields}
277
+ value={[
278
+ { product_id: 'a', product: { value: 'a', label: 'A' }, quantity: 1 },
279
+ { product_id: 'b', product: { value: 'b', label: 'B' }, quantity: 2 },
280
+ ]}
281
+ />
282
+ )
283
+ expect(screen.getByText('2 ítems')).toBeTruthy()
284
+ })
285
+
286
+ it('renders non-ref fields via formatScalar under the schema header', () => {
287
+ render(
288
+ <CollectionCell
289
+ itemFields={itemFields}
290
+ value={[{ product_id: 'a', product: { value: 'a', label: 'A' }, quantity: 7 }]}
291
+ />
292
+ )
293
+ openPopover('1 item')
294
+ expect(screen.getByRole('cell', { name: '7' })).toBeTruthy()
295
+ })
296
+
297
+ it('mirrors the schema labels + resolved ref values in the badge title', () => {
298
+ render(
299
+ <CollectionCell
300
+ itemFields={itemFields}
301
+ value={[
302
+ {
303
+ product_id: '550e8400-e29b-41d4-a716-446655440000',
304
+ product: { value: 'x', label: 'Llanta 195/65' },
305
+ quantity: 2,
306
+ },
307
+ ]}
308
+ />
309
+ )
310
+ const title =
311
+ screen.getByText('1 item').closest('[title]')!.getAttribute('title') ?? ''
312
+ expect(title).toContain('Producto: Llanta 195/65')
313
+ expect(title).toContain('Cantidad: 2')
314
+ expect(title).not.toContain('550e8400')
315
+ })
316
+
317
+ it('is unchanged (generic prettify) when no itemFields are provided', () => {
318
+ render(
319
+ <CollectionCell
320
+ locale="es"
321
+ value={[{ product_id: 'abc', quantity: 2 }]}
322
+ />
323
+ )
324
+ // Generic dict path: the badge title carries the prettified headers and
325
+ // the raw (unresolved) values, exactly as before.
326
+ const title =
327
+ screen.getByText('1 ítem').closest('[title]')!.getAttribute('title') ?? ''
328
+ expect(title).toContain('Producto:')
329
+ expect(title).toContain('Cantidad: 2')
330
+ })
331
+ })
@@ -28,6 +28,59 @@ const UUID_LIKE_RE =
28
28
  /** Host i18n translator (react-i18next `t`), as threaded into the columns factory. */
29
29
  export type Translate = (key: string, options?: any) => string
30
30
 
31
+ /**
32
+ * Declared schema for one column of a jsonb line-items array. Mirrors the
33
+ * kernel v3 `item_fields` entry the backend serves on the column metadata
34
+ * (`col.itemFields` / snake `col.item_fields`). When present it drives the
35
+ * popover mini-table: headers come from `label` (already LOCALIZED by the
36
+ * backend — never re-translated here) and `ref` columns resolve to the
37
+ * backend-injected sibling label instead of the raw uuid.
38
+ */
39
+ export interface ItemField {
40
+ /** jsonb key this column maps to (e.g. `product_id`, `quantity`). */
41
+ key: string
42
+ /** Header text — ALREADY localized by the backend. Used verbatim. */
43
+ label: string
44
+ /** Declarative cell type hint (informational; not branched on today). */
45
+ type?: string
46
+ /** FK target model. When set, the cell renders the resolved sibling label. */
47
+ ref?: string
48
+ }
49
+
50
+ /**
51
+ * Resolves the backend-injected resolved sibling key for a ref item-field,
52
+ * mirroring `relationKeyFor` in dynamic-columns: the raw key with a trailing
53
+ * `_id` stripped (`product_id` → `product`), else `<key>_label`.
54
+ */
55
+ function siblingKeyFor(key: string): string {
56
+ return key.endsWith('_id') ? key.slice(0, -3) : `${key}_label`
57
+ }
58
+
59
+ /**
60
+ * Renders the cell value for one declared item-field of a jsonb row. For a
61
+ * `ref` field it prefers the backend-injected resolved sibling (the FK key
62
+ * without `_id`, else `<key>_label`): a `{ value, label }` object shows its
63
+ * `label`, a bare string shows itself; absent → the raw value via
64
+ * `formatScalar` (truncated uuid). Non-ref fields render `formatScalar(value)`.
65
+ */
66
+ function renderItemFieldValue(
67
+ field: ItemField,
68
+ row: Record<string, unknown>,
69
+ ): string {
70
+ if (field.ref) {
71
+ const sibling = row[siblingKeyFor(field.key)]
72
+ if (sibling && typeof sibling === 'object' && !Array.isArray(sibling)) {
73
+ const label = (sibling as Record<string, unknown>).label
74
+ if (label !== undefined && label !== null && label !== '') {
75
+ return String(label)
76
+ }
77
+ } else if (typeof sibling === 'string' && sibling !== '') {
78
+ return sibling
79
+ }
80
+ }
81
+ return formatScalar(row[field.key])
82
+ }
83
+
31
84
  /** Normalize an org/UI language tag to a base language code (`es-MX` → `es`). */
32
85
  function baseLang(locale?: string): string {
33
86
  return (locale || 'en').toLowerCase().split('-')[0]
@@ -204,11 +257,51 @@ function MiniTable({
204
257
  rows,
205
258
  locale,
206
259
  t,
260
+ itemFields,
207
261
  }: {
208
262
  rows: Record<string, unknown>[]
209
263
  locale?: string
210
264
  t?: Translate
265
+ itemFields?: ItemField[]
211
266
  }) {
267
+ // Schema-driven path: a declared `item_fields` schema fixes the column
268
+ // order + headers (already localized by the backend, used VERBATIM) and
269
+ // resolves ref columns to the injected sibling label instead of the raw
270
+ // uuid. Sibling/raw keys not covered by the schema are dropped from the
271
+ // table (the schema is the source of truth for what to surface).
272
+ if (itemFields && itemFields.length > 0) {
273
+ return (
274
+ <Table>
275
+ <TableHeader>
276
+ <TableRow>
277
+ {itemFields.map((field) => (
278
+ <TableHead
279
+ key={field.key}
280
+ className="text-xs whitespace-nowrap"
281
+ >
282
+ {field.label}
283
+ </TableHead>
284
+ ))}
285
+ </TableRow>
286
+ </TableHeader>
287
+ <TableBody>
288
+ {rows.map((row, i) => (
289
+ <TableRow key={i}>
290
+ {itemFields.map((field) => (
291
+ <TableCell
292
+ key={field.key}
293
+ className="text-xs whitespace-nowrap"
294
+ >
295
+ {renderItemFieldValue(field, row)}
296
+ </TableCell>
297
+ ))}
298
+ </TableRow>
299
+ ))}
300
+ </TableBody>
301
+ </Table>
302
+ )
303
+ }
304
+
212
305
  const keys = unionKeys(rows)
213
306
  if (keys.length === 0) {
214
307
  return <div className="p-3 text-xs text-muted-foreground">-</div>
@@ -319,6 +412,15 @@ export interface CollectionCellProps {
319
412
  locale?: string
320
413
  /** Host i18n translator; takes precedence over the built-in dictionary. */
321
414
  t?: Translate
415
+ /**
416
+ * Declared schema for the jsonb line-items columns (kernel v3 `item_fields`,
417
+ * read from `col.itemFields ?? col.item_fields` at the callsite). When
418
+ * present AND the value is an array of objects, the popover mini-table uses
419
+ * these (already-localized) headers in order and resolves `ref` columns to
420
+ * the backend-injected sibling label. Absent → the generic dict/prettify
421
+ * behaviour is unchanged.
422
+ */
423
+ itemFields?: ItemField[]
322
424
  }
323
425
 
324
426
  /**
@@ -330,6 +432,7 @@ export function CollectionCell({
330
432
  maxInline = 3,
331
433
  locale,
332
434
  t,
435
+ itemFields,
333
436
  }: CollectionCellProps) {
334
437
  const parsed = parseValue(value)
335
438
 
@@ -364,19 +467,39 @@ export function CollectionCell({
364
467
  const rows = parsed as Record<string, unknown>[]
365
468
  const count = rows.length
366
469
  const label = countLabel(count, locale, t)
367
- const title = rows
368
- .map((row) =>
369
- Object.entries(row)
370
- .map(
371
- ([k, v]) =>
372
- `${prettifyKey(k, locale, t)}: ${formatScalar(v)}`
373
- )
374
- .join(', ')
375
- )
376
- .join(' | ')
470
+ const hasSchema = !!(itemFields && itemFields.length > 0)
471
+ // The no-JS tooltip mirrors the rendered table: schema-driven
472
+ // labels + resolved ref values when a schema is present, else the
473
+ // generic prettify/scalar pairs.
474
+ const title = hasSchema
475
+ ? rows
476
+ .map((row) =>
477
+ itemFields!
478
+ .map(
479
+ (field) =>
480
+ `${field.label}: ${renderItemFieldValue(field, row)}`
481
+ )
482
+ .join(', ')
483
+ )
484
+ .join(' | ')
485
+ : rows
486
+ .map((row) =>
487
+ Object.entries(row)
488
+ .map(
489
+ ([k, v]) =>
490
+ `${prettifyKey(k, locale, t)}: ${formatScalar(v)}`
491
+ )
492
+ .join(', ')
493
+ )
494
+ .join(' | ')
377
495
  return (
378
496
  <PopoverShell label={label} title={title}>
379
- <MiniTable rows={rows} locale={locale} t={t} />
497
+ <MiniTable
498
+ rows={rows}
499
+ locale={locale}
500
+ t={t}
501
+ itemFields={itemFields}
502
+ />
380
503
  </PopoverShell>
381
504
  )
382
505
  }
@@ -1179,6 +1179,7 @@ export function makeDefaultGetDynamicColumns(
1179
1179
  value={value}
1180
1180
  locale={currentLanguage}
1181
1181
  t={t}
1182
+ itemFields={col.itemFields ?? col.item_fields}
1182
1183
  />
1183
1184
  )
1184
1185
  }
package/src/types.ts CHANGED
@@ -170,6 +170,33 @@ export interface ColumnDefinition {
170
170
  * reference resolved through the OrgConfigProvider.
171
171
  */
172
172
  validation?: FieldValidation
173
+ /**
174
+ * Declared schema for a jsonb line-items column (kernel v3 `item_fields`).
175
+ * Each entry describes one sub-field of the array's row objects: a `key`
176
+ * (the jsonb key), an already-LOCALIZED `label` (backend-translated), an
177
+ * optional `type` hint and an optional `ref` (FK target). When present the
178
+ * `CollectionCell` renders the popover mini-table with these headers in
179
+ * order and resolves `ref` columns to the backend-injected sibling label
180
+ * (the FK key without `_id`, else `<key>_label`) instead of the raw uuid.
181
+ * Tolerates the snake_case `item_fields` the kernel serves.
182
+ */
183
+ itemFields?: ColumnItemField[]
184
+ /** snake_case alias served by the kernel for `itemFields`. */
185
+ item_fields?: ColumnItemField[]
186
+ }
187
+
188
+ /**
189
+ * One declared sub-field of a jsonb line-items column (see
190
+ * `ColumnDefinition.itemFields`). `label` is already localized by the backend
191
+ * and consumed verbatim; a non-empty `ref` flags the column for resolved-label
192
+ * rendering against the injected sibling. Structurally compatible with the
193
+ * `ItemField` consumed by `collection-cell`.
194
+ */
195
+ export interface ColumnItemField {
196
+ key: string
197
+ label: string
198
+ type?: string
199
+ ref?: string
173
200
  }
174
201
 
175
202
  export interface ActionCondition {