@asteby/metacore-runtime-react 24.0.1 → 25.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.
- package/CHANGELOG.md +25 -0
- package/dist/collection-cell.d.ts.map +1 -1
- package/dist/collection-cell.js +11 -4
- package/dist/display-value.d.ts +9 -0
- package/dist/display-value.d.ts.map +1 -1
- package/dist/display-value.js +1 -1
- package/dist/dynamic-columns.d.ts +9 -0
- package/dist/dynamic-columns.d.ts.map +1 -1
- package/dist/dynamic-columns.js +23 -2
- package/dist/dynamic-line-items.d.ts.map +1 -1
- package/dist/dynamic-line-items.js +6 -2
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/line-items-lock-rows.test.tsx +70 -0
- package/src/collection-cell.tsx +25 -4
- package/src/display-value.tsx +22 -2
- package/src/dynamic-columns.tsx +32 -4
- package/src/dynamic-line-items.tsx +30 -19
- package/src/types.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @asteby/metacore-runtime-react
|
|
2
2
|
|
|
3
|
+
## 25.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 711bdfc: Nuevo flag declarativo `lock_rows` en campos de line-items (`type: "array"`): cuando está activo, el renderer fija las filas — oculta el botón "Agregar renglón" y los botones de borrar por fila, dejando solo editables las celdas de las filas ya presentes. Primitivo genérico del framework (se lee snake_case `lock_rows` con alias camelCase `lockRows`).
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [711bdfc]
|
|
12
|
+
- @asteby/metacore-sdk@3.3.0
|
|
13
|
+
|
|
14
|
+
## 24.0.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- a27d1a2: feat(relations): secondary identifier (SKU/email) under a reference chip
|
|
19
|
+
|
|
20
|
+
Reference chips (resolved FK cells, endpoint-option badges, jsonb line-item refs,
|
|
21
|
+
confirm-modal items) now render a muted secondary line under the label — a
|
|
22
|
+
product's SKU, a user's email — so a resolved record reads "Name / SKU" instead
|
|
23
|
+
of a bare name. Declarative: the SDK reads the backend-projected `subtitle` /
|
|
24
|
+
`description` on the option or resolved sibling (never a hardcoded column). Absent
|
|
25
|
+
→ single-line as before. The select picker already surfaced `description`; this
|
|
26
|
+
brings the resolved-chip surfaces in line.
|
|
27
|
+
|
|
3
28
|
## 24.0.1
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -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;AAkD9B,sFAAsF;AACtF,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,MAAM,CAAA;AAE9D;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACtB,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAA;IACX,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAA;CACf;
|
|
1
|
+
{"version":3,"file":"collection-cell.d.ts","sourceRoot":"","sources":["../src/collection-cell.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAkD9B,sFAAsF;AACtF,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,MAAM,CAAA;AAE9D;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACtB,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAA;IACX,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAA;CACf;AAwOD;;;;;;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,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAYnD;AAkOD,MAAM,WAAW,mBAAmB;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;IACxB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACtC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;CAC/B;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,SAAa,EACb,MAAM,EACN,CAAC,EACD,UAAU,EACV,WAAW,EACX,OAAiB,GACpB,EAAE,mBAAmB,qBA2HrB"}
|
package/dist/collection-cell.js
CHANGED
|
@@ -55,12 +55,16 @@ function resolvedRefFor(field, row) {
|
|
|
55
55
|
const obj = sibling;
|
|
56
56
|
const label = obj.label;
|
|
57
57
|
if (label !== undefined && label !== null && label !== '') {
|
|
58
|
+
const sub = obj.subtitle ?? obj.description;
|
|
58
59
|
return {
|
|
59
60
|
label: String(label),
|
|
60
61
|
value: obj.value,
|
|
61
62
|
image: typeof obj.image === 'string' && obj.image !== ''
|
|
62
63
|
? obj.image
|
|
63
64
|
: undefined,
|
|
65
|
+
subtitle: sub !== undefined && sub !== null && sub !== ''
|
|
66
|
+
? String(sub)
|
|
67
|
+
: undefined,
|
|
64
68
|
};
|
|
65
69
|
}
|
|
66
70
|
}
|
|
@@ -92,10 +96,12 @@ function resolvedRefObject(v) {
|
|
|
92
96
|
const label = v.label;
|
|
93
97
|
if (label === undefined || label === null || label === '')
|
|
94
98
|
return null;
|
|
99
|
+
const sub = v.subtitle ?? v.description;
|
|
95
100
|
return {
|
|
96
101
|
label: String(label),
|
|
97
102
|
value: v.value,
|
|
98
103
|
image: typeof v.image === 'string' && v.image !== '' ? v.image : undefined,
|
|
104
|
+
subtitle: sub !== undefined && sub !== null && sub !== '' ? String(sub) : undefined,
|
|
99
105
|
};
|
|
100
106
|
}
|
|
101
107
|
/**
|
|
@@ -104,9 +110,10 @@ function resolvedRefObject(v) {
|
|
|
104
110
|
* resolved name. The exact look the FK table columns use, so resolved relations
|
|
105
111
|
* read consistently everywhere (table popover, detail view, edit, line items).
|
|
106
112
|
*/
|
|
107
|
-
function RefChip({ label, image, getImageUrl, }) {
|
|
113
|
+
function RefChip({ label, image, subtitle, getImageUrl, }) {
|
|
108
114
|
const isDark = useIsDarkTheme();
|
|
109
|
-
|
|
115
|
+
const size = subtitle ? 24 : 18;
|
|
116
|
+
return (_jsxs("span", { className: "inline-flex max-w-[220px] items-center gap-1.5 rounded-md px-2 py-0.5 text-xs font-medium", style: relationChipStyles(label, { isDark }), title: subtitle ? `${label} · ${subtitle}` : label, children: [image ? (_jsxs(Avatar, { className: "shrink-0 rounded-sm ring-1 ring-border/40", style: { width: size, height: size }, children: [_jsx(AvatarImage, { src: getImageUrl ? getImageUrl(image) : image, alt: label, className: "object-cover" }), _jsx(AvatarFallback, { className: "rounded-sm bg-primary/10 text-[8px] font-bold text-primary", children: getInitials(label) })] })) : (_jsx(Box, { className: "h-3 w-3 shrink-0 opacity-70" })), subtitle ? (_jsxs("span", { className: "flex flex-col leading-tight min-w-0", children: [_jsx("span", { className: "truncate", children: label }), _jsx("span", { className: "truncate text-[0.65rem] opacity-70", children: subtitle })] })) : (_jsx("span", { className: "truncate", children: label }))] }));
|
|
110
117
|
}
|
|
111
118
|
/**
|
|
112
119
|
* Visual cell for one declared item-field. A resolved `ref` renders as a
|
|
@@ -117,7 +124,7 @@ function RefChip({ label, image, getImageUrl, }) {
|
|
|
117
124
|
function ItemFieldCell({ field, row, getImageUrl, }) {
|
|
118
125
|
const ref = resolvedRefFor(field, row);
|
|
119
126
|
if (ref?.label) {
|
|
120
|
-
return (_jsx(RefChip, { label: ref.label, image: ref.image, getImageUrl: getImageUrl }));
|
|
127
|
+
return (_jsx(RefChip, { label: ref.label, image: ref.image, subtitle: ref.subtitle, getImageUrl: getImageUrl }));
|
|
121
128
|
}
|
|
122
129
|
return _jsx(_Fragment, { children: formatScalar(row[field.key]) });
|
|
123
130
|
}
|
|
@@ -311,7 +318,7 @@ function MiniTable({ rows, locale, t, itemFields, getImageUrl, }) {
|
|
|
311
318
|
const ref = refKeys.has(key)
|
|
312
319
|
? resolvedRefObject(row[key])
|
|
313
320
|
: null;
|
|
314
|
-
return (_jsx(TableCell, { className: "text-xs whitespace-nowrap", children: ref ? (_jsx(RefChip, { label: ref.label, image: ref.image, getImageUrl: getImageUrl })) : (formatScalar(row[key])) }, key));
|
|
321
|
+
return (_jsx(TableCell, { className: "text-xs whitespace-nowrap", children: ref ? (_jsx(RefChip, { label: ref.label, image: ref.image, subtitle: ref.subtitle, getImageUrl: getImageUrl })) : (formatScalar(row[key])) }, key));
|
|
315
322
|
}) }, i))) })] }));
|
|
316
323
|
}
|
|
317
324
|
function ScalarList({ values }) {
|
package/dist/display-value.d.ts
CHANGED
|
@@ -39,6 +39,15 @@ export interface DisplayOption {
|
|
|
39
39
|
icon?: string;
|
|
40
40
|
color?: string;
|
|
41
41
|
image?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Secondary identifier shown UNDER the label (muted, smaller) — a product's
|
|
44
|
+
* SKU/barcode, a user's email, etc. Lets a reference chip read like
|
|
45
|
+
* "Camiseta / SKU-001" instead of a bare name, so a resolved record is
|
|
46
|
+
* unambiguous. Populated declaratively: the backend projects it as the
|
|
47
|
+
* option/relation `description` (SearchConfig/FieldOptionsConfig.Description,
|
|
48
|
+
* or a column's `label_description`). Absent → single-line label as before.
|
|
49
|
+
*/
|
|
50
|
+
subtitle?: string;
|
|
42
51
|
}
|
|
43
52
|
/**
|
|
44
53
|
* Colored option badge — the canonical "pro" pill for a select/status/badge
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display-value.d.ts","sourceRoot":"","sources":["../src/display-value.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAmBxC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAepD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACtC,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB,CAcA,CAAA;AAED,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"display-value.d.ts","sourceRoot":"","sources":["../src/display-value.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAmBxC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAepD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACtC,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB,CAcA,CAAA;AAED,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC;IAC/B,MAAM,EAAE,aAAa,CAAA;IACrB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACtC,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB,CA8BA,CAAA"}
|
package/dist/display-value.js
CHANGED
|
@@ -70,5 +70,5 @@ export const OptionBadge = ({ option, getImageUrl }) => {
|
|
|
70
70
|
const isDark = useIsDarkTheme();
|
|
71
71
|
const colorSource = option.color || optionColor(option.value || option.label);
|
|
72
72
|
const colorStyles = generateBadgeStyles(colorSource, { isDark });
|
|
73
|
-
return (_jsxs(Badge, { variant: "outline", className: "flex items-center gap-1 border-0", style: colorStyles, children: [option.image ? (_jsx(RelationThumbnail, { src: option.image, alt: option.label, getImageUrl: getImageUrl, size: 16 })) : (option.icon && _jsx(DynamicIcon, { name: option.icon, className: "h-3.5 w-3.5" })), _jsx("span", { children: option.label })] }));
|
|
73
|
+
return (_jsxs(Badge, { variant: "outline", className: "flex items-center gap-1 border-0", style: colorStyles, children: [option.image ? (_jsx(RelationThumbnail, { src: option.image, alt: option.label, getImageUrl: getImageUrl, size: option.subtitle ? 22 : 16 })) : (option.icon && _jsx(DynamicIcon, { name: option.icon, className: "h-3.5 w-3.5" })), option.subtitle ? (_jsxs("span", { className: "flex flex-col leading-tight text-start", children: [_jsx("span", { children: option.label }), _jsx("span", { className: "text-[0.7rem] opacity-70", children: option.subtitle })] })) : (_jsx("span", { children: option.label }))] }));
|
|
74
74
|
};
|
|
@@ -112,6 +112,15 @@ export declare const resolveRelationLabel: (col: ColumnDefinition, row: any) =>
|
|
|
112
112
|
* the chip then renders text-only, exactly as before.
|
|
113
113
|
*/
|
|
114
114
|
export declare const resolveRelationImage: (col: ColumnDefinition, row: any) => string;
|
|
115
|
+
/**
|
|
116
|
+
* Reads a secondary identifier the backend stamps on a resolved FK sibling — a
|
|
117
|
+
* product's SKU, a user's email — projected as `subtitle`/`description` (the
|
|
118
|
+
* relational twin of `image` via the column's `label_description`). Rendered
|
|
119
|
+
* muted under the label so a reference chip reads "Name / SKU". Domain-agnostic:
|
|
120
|
+
* only the generic `subtitle`/`description` keys are read (never a hardcoded
|
|
121
|
+
* `sku`/`code`), so the author picks the column declaratively. '' when absent.
|
|
122
|
+
*/
|
|
123
|
+
export declare const resolveRelationSubtitle: (col: ColumnDefinition, row: any) => string;
|
|
115
124
|
/**
|
|
116
125
|
* Builds the canonical column factory used by `<DynamicTable>` when the host
|
|
117
126
|
* does not supply its own. Pass `{ getImageUrl, apiBaseUrl }` to wire avatar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-columns.d.ts","sourceRoot":"","sources":["../src/dynamic-columns.tsx"],"names":[],"mappings":"AAgBA,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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;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAAI,KAAK,gBAAgB,EAAE,KAAK,GAAG,KAAG,MAOzE,CAAA;AA8ID;;;;GAIG;AACH,wBAAgB,4BAA4B,CACxC,OAAO,GAAE,qBAA0B,GACpC,iBAAiB,CAqmBnB;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,iBACL,CAAA"}
|
package/dist/dynamic-columns.js
CHANGED
|
@@ -213,8 +213,11 @@ const BadgeWithEndpointOptions = ({ endpoint, value, getImageUrl }) => {
|
|
|
213
213
|
const { optionsMap } = React.useContext(OptionsContext);
|
|
214
214
|
const options = optionsMap.get(endpoint) || [];
|
|
215
215
|
const option = options.find((opt) => opt.value === value);
|
|
216
|
+
// Reference options carry the backend-projected `description` (the SKU/email
|
|
217
|
+
// the author pointed the options config at) — surface it as the chip subtitle
|
|
218
|
+
// so a resolved record reads "Name / SKU" instead of a bare name.
|
|
216
219
|
if (option)
|
|
217
|
-
return _jsx(OptionBadge, { option: option, fallback: String(value), getImageUrl: getImageUrl });
|
|
220
|
+
return _jsx(OptionBadge, { option: { ...option, subtitle: option.subtitle ?? option.description }, fallback: String(value), getImageUrl: getImageUrl });
|
|
218
221
|
// No declared option matched → humanize the raw token as a safety net so a
|
|
219
222
|
// cell never shows `in_progress` verbatim (option.label still wins above).
|
|
220
223
|
return _jsx(Badge, { variant: "outline", children: humanizeToken(value) });
|
|
@@ -336,6 +339,23 @@ export const resolveRelationImage = (col, row) => {
|
|
|
336
339
|
}
|
|
337
340
|
return '';
|
|
338
341
|
};
|
|
342
|
+
/**
|
|
343
|
+
* Reads a secondary identifier the backend stamps on a resolved FK sibling — a
|
|
344
|
+
* product's SKU, a user's email — projected as `subtitle`/`description` (the
|
|
345
|
+
* relational twin of `image` via the column's `label_description`). Rendered
|
|
346
|
+
* muted under the label so a reference chip reads "Name / SKU". Domain-agnostic:
|
|
347
|
+
* only the generic `subtitle`/`description` keys are read (never a hardcoded
|
|
348
|
+
* `sku`/`code`), so the author picks the column declaratively. '' when absent.
|
|
349
|
+
*/
|
|
350
|
+
export const resolveRelationSubtitle = (col, row) => {
|
|
351
|
+
const sibling = getNestedValue(row, relationKeyFor(col));
|
|
352
|
+
if (sibling && typeof sibling === 'object') {
|
|
353
|
+
const sub = sibling.subtitle ?? sibling.description;
|
|
354
|
+
if (sub !== undefined && sub !== null && sub !== '')
|
|
355
|
+
return String(sub);
|
|
356
|
+
}
|
|
357
|
+
return '';
|
|
358
|
+
};
|
|
339
359
|
/**
|
|
340
360
|
* Renders a resolved FK relation as a clean, truncated chip. Reads the
|
|
341
361
|
* backend-resolved sibling `{ value, label[, image] }` (see `relationKeyFor`)
|
|
@@ -350,12 +370,13 @@ const RelationCell = ({ col, row, getImageUrl }) => {
|
|
|
350
370
|
if (!display)
|
|
351
371
|
return _jsx(EmptyCell, {});
|
|
352
372
|
const image = resolveRelationImage(col, row);
|
|
373
|
+
const subtitle = resolveRelationSubtitle(col, row);
|
|
353
374
|
// Deterministic, SUBTLE color keyed on the resolved label — lighter than
|
|
354
375
|
// enum badges (soft tint, no heavy fill) so category/brand chips read as
|
|
355
376
|
// alive yet stay visually distinct from option/status badges. Inline style
|
|
356
377
|
// (hex-derived) bypasses the host tailwind safelist.
|
|
357
378
|
const chipStyles = relationChipStyles(display, { isDark });
|
|
358
|
-
return (_jsxs("span", { className: "inline-flex max-w-[220px] items-center gap-1.5 rounded-md px-2 py-0.5 text-sm font-medium", style: chipStyles, title: display, children: [image && (_jsx(RelationThumbnail, { src: image, alt: display, getImageUrl: getImageUrl, size: 18 })), _jsx("span", { className: "truncate", children: display })] }));
|
|
379
|
+
return (_jsxs("span", { className: "inline-flex max-w-[220px] items-center gap-1.5 rounded-md px-2 py-0.5 text-sm font-medium", style: chipStyles, title: subtitle ? `${display} · ${subtitle}` : display, children: [image && (_jsx(RelationThumbnail, { src: image, alt: display, getImageUrl: getImageUrl, size: subtitle ? 24 : 18 })), subtitle ? (_jsxs("span", { className: "flex flex-col leading-tight min-w-0", children: [_jsx("span", { className: "truncate", children: display }), _jsx("span", { className: "truncate text-[0.7rem] opacity-70", children: subtitle })] })) : (_jsx("span", { className: "truncate", children: display }))] }));
|
|
359
380
|
};
|
|
360
381
|
/**
|
|
361
382
|
* Renders a SAP-style polymorphic source-document reference as a navigable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-line-items.d.ts","sourceRoot":"","sources":["../src/dynamic-line-items.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAgB7C,MAAM,WAAW,qBAAqB;IAClC,KAAK,EAAE,cAAc,CAAA;IACrB,KAAK,EAAE,GAAG,EAAE,GAAG,SAAS,CAAA;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACnC;AAkBD,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAgB,EAAE,UAAU,EAAE,EAAE,qBAAqB,+
|
|
1
|
+
{"version":3,"file":"dynamic-line-items.d.ts","sourceRoot":"","sources":["../src/dynamic-line-items.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAgB7C,MAAM,WAAW,qBAAqB;IAClC,KAAK,EAAE,cAAc,CAAA;IACrB,KAAK,EAAE,GAAG,EAAE,GAAG,SAAS,CAAA;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACnC;AAkBD,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAgB,EAAE,UAAU,EAAE,EAAE,qBAAqB,+BA8J/G"}
|
|
@@ -29,6 +29,10 @@ function emptyRow(itemFields) {
|
|
|
29
29
|
export function DynamicLineItems({ field, value, onChange, disabled = false, formValues }) {
|
|
30
30
|
const itemFields = getItemFields(field);
|
|
31
31
|
const rows = Array.isArray(value) ? value : [];
|
|
32
|
+
// `lock_rows` fixes the row set: no add-row button, no per-row delete. Rows
|
|
33
|
+
// stay editable cell-by-cell. Snake_case is what the kernel serves; tolerate
|
|
34
|
+
// the camelCase alias too. Derived once.
|
|
35
|
+
const lockRows = field.lock_rows ?? field.lockRows ?? false;
|
|
32
36
|
// Columns flagged `total` get a per-column sum in the footer; the balance
|
|
33
37
|
// rule (if any) reconciles two of them. Both are declarative & generic.
|
|
34
38
|
const totals = computeLineItemTotals(field, rows);
|
|
@@ -60,7 +64,7 @@ export function DynamicLineItems({ field, value, onChange, disabled = false, for
|
|
|
60
64
|
updateCell(idx, key, cellValue);
|
|
61
65
|
};
|
|
62
66
|
return (_jsxs("div", { className: "grid gap-2", "data-widget": "line_items", children: [_jsx("div", { className: "overflow-x-auto rounded-md border", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-muted/50", children: _jsxs("tr", { children: [itemFields.map((col) => (_jsxs("th", { className: 'px-3 py-2 font-medium ' +
|
|
63
|
-
(isNumericCol(col) ? 'text-right' : 'text-left'), children: [col.label, col.required && _jsx("span", { className: "text-red-500 ml-1", children: "*" })] }, col.key))), _jsx("th", { className: "w-12 px-3 py-2", "aria-label": "acciones" })] }) }), _jsxs("tbody", { children: [rows.length === 0 && (_jsx("tr", { children: _jsx("td", { colSpan: itemFields.length + 1, className: "px-3 py-4 text-center text-muted-foreground", children: "Sin renglones" }) })), rows.map((row, idx) => (_jsxs("tr", { className: "border-t align-top", children: [itemFields.map((col) => (_jsx("td", { className: "px-2 py-1.5", children: _jsx(CellRenderer, { field: col, value: row?.[col.key], onChange: (v) => handleCell(idx, col.key, v), disabled: disabled, formValues: formValues, rowValues: row }) }, col.key))), _jsx("td", { className: "px-2 py-1.5 text-center", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", onClick: () => removeRow(idx), disabled: disabled, "aria-label": "Eliminar rengl\u00F3n", children: _jsx(Trash2, { className: "h-4 w-4 text-red-500" }) }) })] }, idx)))] }), hasTotals && rows.length > 0 && (_jsx("tfoot", { className: "border-t bg-muted/30", children: _jsxs("tr", { children: [itemFields.map((col, ci) => {
|
|
67
|
+
(isNumericCol(col) ? 'text-right' : 'text-left'), children: [col.label, col.required && _jsx("span", { className: "text-red-500 ml-1", children: "*" })] }, col.key))), !lockRows && _jsx("th", { className: "w-12 px-3 py-2", "aria-label": "acciones" })] }) }), _jsxs("tbody", { children: [rows.length === 0 && (_jsx("tr", { children: _jsx("td", { colSpan: itemFields.length + (lockRows ? 0 : 1), className: "px-3 py-4 text-center text-muted-foreground", children: "Sin renglones" }) })), rows.map((row, idx) => (_jsxs("tr", { className: "border-t align-top", children: [itemFields.map((col) => (_jsx("td", { className: "px-2 py-1.5", children: _jsx(CellRenderer, { field: col, value: row?.[col.key], onChange: (v) => handleCell(idx, col.key, v), disabled: disabled, formValues: formValues, rowValues: row }) }, col.key))), !lockRows && (_jsx("td", { className: "px-2 py-1.5 text-center", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", onClick: () => removeRow(idx), disabled: disabled, "aria-label": "Eliminar rengl\u00F3n", children: _jsx(Trash2, { className: "h-4 w-4 text-red-500" }) }) }))] }, idx)))] }), hasTotals && rows.length > 0 && (_jsx("tfoot", { className: "border-t bg-muted/30", children: _jsxs("tr", { children: [itemFields.map((col, ci) => {
|
|
64
68
|
if (ci === 0) {
|
|
65
69
|
return (_jsx("td", { className: "px-3 py-2 text-left font-medium text-muted-foreground", children: "Totales" }, col.key));
|
|
66
70
|
}
|
|
@@ -68,7 +72,7 @@ export function DynamicLineItems({ field, value, onChange, disabled = false, for
|
|
|
68
72
|
(col.total
|
|
69
73
|
? 'text-right font-semibold tabular-nums'
|
|
70
74
|
: ''), children: col.total ? fmtNumber(totals[col.key] ?? 0) : null }, col.key));
|
|
71
|
-
}), _jsx("td", {})] }) }))] }) }), _jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: addRow, disabled: disabled, children: [_jsx(Plus, { className: "mr-1 h-4 w-4" }), "Agregar rengl\u00F3n"] }), balance && _jsx(BalanceBadge, { state: balance })] })] }));
|
|
75
|
+
}), !lockRows && _jsx("td", {})] }) }))] }) }), _jsxs("div", { className: "flex items-center justify-between gap-2", children: [lockRows ? (_jsx("span", {})) : (_jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: addRow, disabled: disabled, children: [_jsx(Plus, { className: "mr-1 h-4 w-4" }), "Agregar rengl\u00F3n"] })), balance && _jsx(BalanceBadge, { state: balance })] })] }));
|
|
72
76
|
}
|
|
73
77
|
function BalanceBadge({ state, }) {
|
|
74
78
|
if (state.balanced) {
|
package/dist/types.d.ts
CHANGED
|
@@ -393,6 +393,16 @@ export interface ActionFieldDef {
|
|
|
393
393
|
* reconcile. Mirrors kernel v3 `ActionField.balance`.
|
|
394
394
|
*/
|
|
395
395
|
balance?: FieldBalanceRule;
|
|
396
|
+
/**
|
|
397
|
+
* On a line-items (`type: "array"`) field: fixes the set of rows. When true
|
|
398
|
+
* the SDK hides the "Agregar renglón" button and the per-row delete control,
|
|
399
|
+
* so the rows served (e.g. a prefilled set of allocations) can only have
|
|
400
|
+
* their cells edited — never added to or removed. Generic & domain-agnostic.
|
|
401
|
+
* Mirrors kernel v3 `ActionField.lock_rows`. Tolerates the camelCase alias.
|
|
402
|
+
*/
|
|
403
|
+
lock_rows?: boolean;
|
|
404
|
+
/** camelCase alias for `lock_rows`. */
|
|
405
|
+
lockRows?: boolean;
|
|
396
406
|
/**
|
|
397
407
|
* `upload` widget: comma-separated accept list forwarded to the file input
|
|
398
408
|
* `accept` attribute (e.g. `"image/*,.pdf"`). Tolerates the snake_case the
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,SAAS,EAAE,CAAA;IACpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,aAAa,EAAE,CAAA;IAC7B;;;;;OAKG;I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E,GAAG,CAAC,CAAA;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,cAAc;IAC3B,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;CAChB;AAKD,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,cAAc,EAAE,CAAA;CAC3B;AAED,MAAM,WAAW,cAAc;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAA;IACzB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,UAAU,EAAE,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;CACzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asteby/metacore-runtime-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0",
|
|
4
4
|
"description": "React runtime for metacore hosts — renders addon contributions dynamically",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"react-i18next": ">=13",
|
|
38
38
|
"sonner": ">=1.7",
|
|
39
39
|
"zustand": ">=5",
|
|
40
|
-
"@asteby/metacore-sdk": "^3.
|
|
41
|
-
"@asteby/metacore-ui": "^2.10.
|
|
40
|
+
"@asteby/metacore-sdk": "^3.3.0",
|
|
41
|
+
"@asteby/metacore-ui": "^2.10.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"@tanstack/react-router": {
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"typescript": "^6.0.0",
|
|
68
68
|
"vitest": "^4.0.0",
|
|
69
69
|
"zustand": "^5.0.0",
|
|
70
|
-
"@asteby/metacore-sdk": "3.
|
|
71
|
-
"@asteby/metacore-ui": "2.10.
|
|
70
|
+
"@asteby/metacore-sdk": "3.3.0",
|
|
71
|
+
"@asteby/metacore-ui": "2.10.1"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "tsc -p tsconfig.json",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
//
|
|
3
|
+
// `lock_rows` on a line-items (type "array") field fixes the row set: the SDK
|
|
4
|
+
// hides the "Agregar renglón" button and every per-row delete control, so the
|
|
5
|
+
// served rows can only have their cells edited — never added to or removed.
|
|
6
|
+
// Generic framework primitive (mirrors kernel v3 `ActionField.lock_rows`).
|
|
7
|
+
//
|
|
8
|
+
// Cells here are plain text/number inputs on purpose: no Radix Select, so the
|
|
9
|
+
// happy-dom BubbleSelect value-reset gotcha does not apply.
|
|
10
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
11
|
+
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
|
12
|
+
import { DynamicLineItems } from '../dynamic-line-items'
|
|
13
|
+
import type { ActionFieldDef } from '../types'
|
|
14
|
+
|
|
15
|
+
afterEach(cleanup)
|
|
16
|
+
|
|
17
|
+
const lineField = (overrides: Partial<ActionFieldDef> = {}): ActionFieldDef => ({
|
|
18
|
+
key: 'allocations',
|
|
19
|
+
label: 'Renglones',
|
|
20
|
+
type: 'array',
|
|
21
|
+
itemFields: [
|
|
22
|
+
{ key: 'sku', label: 'SKU', type: 'text' },
|
|
23
|
+
{ key: 'qty', label: 'Cantidad', type: 'number' },
|
|
24
|
+
],
|
|
25
|
+
...overrides,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const rows = [
|
|
29
|
+
{ sku: 'A-1', qty: 2 },
|
|
30
|
+
{ sku: 'B-2', qty: 5 },
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
describe('DynamicLineItems — lock_rows', () => {
|
|
34
|
+
it('con lock_rows=true oculta "Agregar renglón" y los botones de borrar, pero deja editar celdas', () => {
|
|
35
|
+
const onChange = vi.fn()
|
|
36
|
+
render(
|
|
37
|
+
<DynamicLineItems field={lineField({ lock_rows: true })} value={rows} onChange={onChange} />,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
// No add-row control, no per-row delete controls.
|
|
41
|
+
expect(screen.queryByText('Agregar renglón')).toBeNull()
|
|
42
|
+
expect(screen.queryByLabelText('Eliminar renglón')).toBeNull()
|
|
43
|
+
|
|
44
|
+
// Cells stay editable: typing into a cell fires onChange with the row updated.
|
|
45
|
+
const skuInputs = screen.getAllByDisplayValue('A-1')
|
|
46
|
+
fireEvent.change(skuInputs[0], { target: { value: 'A-9' } })
|
|
47
|
+
expect(onChange).toHaveBeenCalledWith([
|
|
48
|
+
{ sku: 'A-9', qty: 2 },
|
|
49
|
+
{ sku: 'B-2', qty: 5 },
|
|
50
|
+
])
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('acepta el alias camelCase lockRows', () => {
|
|
54
|
+
render(
|
|
55
|
+
<DynamicLineItems
|
|
56
|
+
field={lineField({ lockRows: true })}
|
|
57
|
+
value={rows}
|
|
58
|
+
onChange={vi.fn()}
|
|
59
|
+
/>,
|
|
60
|
+
)
|
|
61
|
+
expect(screen.queryByText('Agregar renglón')).toBeNull()
|
|
62
|
+
expect(screen.queryByLabelText('Eliminar renglón')).toBeNull()
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('control: sin lock_rows muestra "Agregar renglón" y un botón de borrar por fila', () => {
|
|
66
|
+
render(<DynamicLineItems field={lineField()} value={rows} onChange={vi.fn()} />)
|
|
67
|
+
expect(screen.getByText('Agregar renglón')).toBeTruthy()
|
|
68
|
+
expect(screen.getAllByLabelText('Eliminar renglón')).toHaveLength(2)
|
|
69
|
+
})
|
|
70
|
+
})
|
package/src/collection-cell.tsx
CHANGED
|
@@ -92,6 +92,8 @@ interface ResolvedRef {
|
|
|
92
92
|
value?: unknown
|
|
93
93
|
/** Optional thumbnail (product photo, logo, avatar) resolved by the backend. */
|
|
94
94
|
image?: string
|
|
95
|
+
/** Optional secondary identifier (SKU/email) shown muted under the label. */
|
|
96
|
+
subtitle?: string
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
/**
|
|
@@ -110,6 +112,7 @@ function resolvedRefFor(
|
|
|
110
112
|
const obj = sibling as Record<string, unknown>
|
|
111
113
|
const label = obj.label
|
|
112
114
|
if (label !== undefined && label !== null && label !== '') {
|
|
115
|
+
const sub = obj.subtitle ?? obj.description
|
|
113
116
|
return {
|
|
114
117
|
label: String(label),
|
|
115
118
|
value: obj.value,
|
|
@@ -117,6 +120,10 @@ function resolvedRefFor(
|
|
|
117
120
|
typeof obj.image === 'string' && obj.image !== ''
|
|
118
121
|
? obj.image
|
|
119
122
|
: undefined,
|
|
123
|
+
subtitle:
|
|
124
|
+
sub !== undefined && sub !== null && sub !== ''
|
|
125
|
+
? String(sub)
|
|
126
|
+
: undefined,
|
|
120
127
|
}
|
|
121
128
|
}
|
|
122
129
|
} else if (typeof sibling === 'string' && sibling !== '') {
|
|
@@ -148,11 +155,14 @@ function resolvedRefObject(
|
|
|
148
155
|
if (!isPlainObject(v)) return null
|
|
149
156
|
const label = v.label
|
|
150
157
|
if (label === undefined || label === null || label === '') return null
|
|
158
|
+
const sub = v.subtitle ?? v.description
|
|
151
159
|
return {
|
|
152
160
|
label: String(label),
|
|
153
161
|
value: v.value,
|
|
154
162
|
image:
|
|
155
163
|
typeof v.image === 'string' && v.image !== '' ? v.image : undefined,
|
|
164
|
+
subtitle:
|
|
165
|
+
sub !== undefined && sub !== null && sub !== '' ? String(sub) : undefined,
|
|
156
166
|
}
|
|
157
167
|
}
|
|
158
168
|
|
|
@@ -165,23 +175,26 @@ function resolvedRefObject(
|
|
|
165
175
|
function RefChip({
|
|
166
176
|
label,
|
|
167
177
|
image,
|
|
178
|
+
subtitle,
|
|
168
179
|
getImageUrl,
|
|
169
180
|
}: {
|
|
170
181
|
label: string
|
|
171
182
|
image?: string
|
|
183
|
+
subtitle?: string
|
|
172
184
|
getImageUrl?: (path: string) => string
|
|
173
185
|
}): React.ReactElement {
|
|
174
186
|
const isDark = useIsDarkTheme()
|
|
187
|
+
const size = subtitle ? 24 : 18
|
|
175
188
|
return (
|
|
176
189
|
<span
|
|
177
190
|
className="inline-flex max-w-[220px] items-center gap-1.5 rounded-md px-2 py-0.5 text-xs font-medium"
|
|
178
191
|
style={relationChipStyles(label, { isDark })}
|
|
179
|
-
title={label}
|
|
192
|
+
title={subtitle ? `${label} · ${subtitle}` : label}
|
|
180
193
|
>
|
|
181
194
|
{image ? (
|
|
182
195
|
<Avatar
|
|
183
196
|
className="shrink-0 rounded-sm ring-1 ring-border/40"
|
|
184
|
-
style={{ width:
|
|
197
|
+
style={{ width: size, height: size }}
|
|
185
198
|
>
|
|
186
199
|
<AvatarImage
|
|
187
200
|
src={getImageUrl ? getImageUrl(image) : image}
|
|
@@ -195,7 +208,14 @@ function RefChip({
|
|
|
195
208
|
) : (
|
|
196
209
|
<Box className="h-3 w-3 shrink-0 opacity-70" />
|
|
197
210
|
)}
|
|
198
|
-
|
|
211
|
+
{subtitle ? (
|
|
212
|
+
<span className="flex flex-col leading-tight min-w-0">
|
|
213
|
+
<span className="truncate">{label}</span>
|
|
214
|
+
<span className="truncate text-[0.65rem] opacity-70">{subtitle}</span>
|
|
215
|
+
</span>
|
|
216
|
+
) : (
|
|
217
|
+
<span className="truncate">{label}</span>
|
|
218
|
+
)}
|
|
199
219
|
</span>
|
|
200
220
|
)
|
|
201
221
|
}
|
|
@@ -218,7 +238,7 @@ function ItemFieldCell({
|
|
|
218
238
|
const ref = resolvedRefFor(field, row)
|
|
219
239
|
if (ref?.label) {
|
|
220
240
|
return (
|
|
221
|
-
<RefChip label={ref.label} image={ref.image} getImageUrl={getImageUrl} />
|
|
241
|
+
<RefChip label={ref.label} image={ref.image} subtitle={ref.subtitle} getImageUrl={getImageUrl} />
|
|
222
242
|
)
|
|
223
243
|
}
|
|
224
244
|
return <>{formatScalar(row[field.key])}</>
|
|
@@ -495,6 +515,7 @@ function MiniTable({
|
|
|
495
515
|
<RefChip
|
|
496
516
|
label={ref.label}
|
|
497
517
|
image={ref.image}
|
|
518
|
+
subtitle={ref.subtitle}
|
|
498
519
|
getImageUrl={getImageUrl}
|
|
499
520
|
/>
|
|
500
521
|
) : (
|
package/src/display-value.tsx
CHANGED
|
@@ -98,6 +98,15 @@ export interface DisplayOption {
|
|
|
98
98
|
icon?: string
|
|
99
99
|
color?: string
|
|
100
100
|
image?: string
|
|
101
|
+
/**
|
|
102
|
+
* Secondary identifier shown UNDER the label (muted, smaller) — a product's
|
|
103
|
+
* SKU/barcode, a user's email, etc. Lets a reference chip read like
|
|
104
|
+
* "Camiseta / SKU-001" instead of a bare name, so a resolved record is
|
|
105
|
+
* unambiguous. Populated declaratively: the backend projects it as the
|
|
106
|
+
* option/relation `description` (SearchConfig/FieldOptionsConfig.Description,
|
|
107
|
+
* or a column's `label_description`). Absent → single-line label as before.
|
|
108
|
+
*/
|
|
109
|
+
subtitle?: string
|
|
101
110
|
}
|
|
102
111
|
|
|
103
112
|
/**
|
|
@@ -123,12 +132,23 @@ export const OptionBadge: React.FC<{
|
|
|
123
132
|
src={option.image}
|
|
124
133
|
alt={option.label}
|
|
125
134
|
getImageUrl={getImageUrl}
|
|
126
|
-
size={16}
|
|
135
|
+
size={option.subtitle ? 22 : 16}
|
|
127
136
|
/>
|
|
128
137
|
) : (
|
|
129
138
|
option.icon && <DynamicIcon name={option.icon} className="h-3.5 w-3.5" />
|
|
130
139
|
)}
|
|
131
|
-
|
|
140
|
+
{option.subtitle ? (
|
|
141
|
+
// Two-line identity: label on top, the secondary identifier
|
|
142
|
+
// (SKU/email/…) muted underneath. `leading-tight` keeps the pill
|
|
143
|
+
// compact; the subtitle inherits the badge's fg at reduced opacity
|
|
144
|
+
// so it reads as secondary on any color.
|
|
145
|
+
<span className="flex flex-col leading-tight text-start">
|
|
146
|
+
<span>{option.label}</span>
|
|
147
|
+
<span className="text-[0.7rem] opacity-70">{option.subtitle}</span>
|
|
148
|
+
</span>
|
|
149
|
+
) : (
|
|
150
|
+
<span>{option.label}</span>
|
|
151
|
+
)}
|
|
132
152
|
</Badge>
|
|
133
153
|
)
|
|
134
154
|
}
|
package/src/dynamic-columns.tsx
CHANGED
|
@@ -332,7 +332,10 @@ const BadgeWithEndpointOptions: React.FC<{
|
|
|
332
332
|
const { optionsMap } = React.useContext(OptionsContext)
|
|
333
333
|
const options = optionsMap.get(endpoint) || []
|
|
334
334
|
const option = options.find((opt: any) => opt.value === value)
|
|
335
|
-
|
|
335
|
+
// Reference options carry the backend-projected `description` (the SKU/email
|
|
336
|
+
// the author pointed the options config at) — surface it as the chip subtitle
|
|
337
|
+
// so a resolved record reads "Name / SKU" instead of a bare name.
|
|
338
|
+
if (option) return <OptionBadge option={{ ...option, subtitle: option.subtitle ?? (option as any).description }} fallback={String(value)} getImageUrl={getImageUrl} />
|
|
336
339
|
// No declared option matched → humanize the raw token as a safety net so a
|
|
337
340
|
// cell never shows `in_progress` verbatim (option.label still wins above).
|
|
338
341
|
return <Badge variant="outline">{humanizeToken(value)}</Badge>
|
|
@@ -461,6 +464,23 @@ export const resolveRelationImage = (col: ColumnDefinition, row: any): string =>
|
|
|
461
464
|
return ''
|
|
462
465
|
}
|
|
463
466
|
|
|
467
|
+
/**
|
|
468
|
+
* Reads a secondary identifier the backend stamps on a resolved FK sibling — a
|
|
469
|
+
* product's SKU, a user's email — projected as `subtitle`/`description` (the
|
|
470
|
+
* relational twin of `image` via the column's `label_description`). Rendered
|
|
471
|
+
* muted under the label so a reference chip reads "Name / SKU". Domain-agnostic:
|
|
472
|
+
* only the generic `subtitle`/`description` keys are read (never a hardcoded
|
|
473
|
+
* `sku`/`code`), so the author picks the column declaratively. '' when absent.
|
|
474
|
+
*/
|
|
475
|
+
export const resolveRelationSubtitle = (col: ColumnDefinition, row: any): string => {
|
|
476
|
+
const sibling = getNestedValue(row, relationKeyFor(col))
|
|
477
|
+
if (sibling && typeof sibling === 'object') {
|
|
478
|
+
const sub = sibling.subtitle ?? sibling.description
|
|
479
|
+
if (sub !== undefined && sub !== null && sub !== '') return String(sub)
|
|
480
|
+
}
|
|
481
|
+
return ''
|
|
482
|
+
}
|
|
483
|
+
|
|
464
484
|
/**
|
|
465
485
|
* Renders a resolved FK relation as a clean, truncated chip. Reads the
|
|
466
486
|
* backend-resolved sibling `{ value, label[, image] }` (see `relationKeyFor`)
|
|
@@ -478,6 +498,7 @@ const RelationCell: React.FC<{
|
|
|
478
498
|
const display = resolveRelationLabel(col, row)
|
|
479
499
|
if (!display) return <EmptyCell />
|
|
480
500
|
const image = resolveRelationImage(col, row)
|
|
501
|
+
const subtitle = resolveRelationSubtitle(col, row)
|
|
481
502
|
// Deterministic, SUBTLE color keyed on the resolved label — lighter than
|
|
482
503
|
// enum badges (soft tint, no heavy fill) so category/brand chips read as
|
|
483
504
|
// alive yet stay visually distinct from option/status badges. Inline style
|
|
@@ -487,12 +508,19 @@ const RelationCell: React.FC<{
|
|
|
487
508
|
<span
|
|
488
509
|
className="inline-flex max-w-[220px] items-center gap-1.5 rounded-md px-2 py-0.5 text-sm font-medium"
|
|
489
510
|
style={chipStyles}
|
|
490
|
-
title={display}
|
|
511
|
+
title={subtitle ? `${display} · ${subtitle}` : display}
|
|
491
512
|
>
|
|
492
513
|
{image && (
|
|
493
|
-
<RelationThumbnail src={image} alt={display} getImageUrl={getImageUrl} size={18} />
|
|
514
|
+
<RelationThumbnail src={image} alt={display} getImageUrl={getImageUrl} size={subtitle ? 24 : 18} />
|
|
515
|
+
)}
|
|
516
|
+
{subtitle ? (
|
|
517
|
+
<span className="flex flex-col leading-tight min-w-0">
|
|
518
|
+
<span className="truncate">{display}</span>
|
|
519
|
+
<span className="truncate text-[0.7rem] opacity-70">{subtitle}</span>
|
|
520
|
+
</span>
|
|
521
|
+
) : (
|
|
522
|
+
<span className="truncate">{display}</span>
|
|
494
523
|
)}
|
|
495
|
-
<span className="truncate">{display}</span>
|
|
496
524
|
</span>
|
|
497
525
|
)
|
|
498
526
|
}
|
|
@@ -69,6 +69,11 @@ export function DynamicLineItems({ field, value, onChange, disabled = false, for
|
|
|
69
69
|
const itemFields = getItemFields(field)
|
|
70
70
|
const rows: any[] = Array.isArray(value) ? value : []
|
|
71
71
|
|
|
72
|
+
// `lock_rows` fixes the row set: no add-row button, no per-row delete. Rows
|
|
73
|
+
// stay editable cell-by-cell. Snake_case is what the kernel serves; tolerate
|
|
74
|
+
// the camelCase alias too. Derived once.
|
|
75
|
+
const lockRows = field.lock_rows ?? (field as any).lockRows ?? false
|
|
76
|
+
|
|
72
77
|
// Columns flagged `total` get a per-column sum in the footer; the balance
|
|
73
78
|
// rule (if any) reconciles two of them. Both are declarative & generic.
|
|
74
79
|
const totals = computeLineItemTotals(field, rows)
|
|
@@ -126,14 +131,14 @@ export function DynamicLineItems({ field, value, onChange, disabled = false, for
|
|
|
126
131
|
{col.required && <span className="text-red-500 ml-1">*</span>}
|
|
127
132
|
</th>
|
|
128
133
|
))}
|
|
129
|
-
<th className="w-12 px-3 py-2" aria-label="acciones" />
|
|
134
|
+
{!lockRows && <th className="w-12 px-3 py-2" aria-label="acciones" />}
|
|
130
135
|
</tr>
|
|
131
136
|
</thead>
|
|
132
137
|
<tbody>
|
|
133
138
|
{rows.length === 0 && (
|
|
134
139
|
<tr>
|
|
135
140
|
<td
|
|
136
|
-
colSpan={itemFields.length + 1}
|
|
141
|
+
colSpan={itemFields.length + (lockRows ? 0 : 1)}
|
|
137
142
|
className="px-3 py-4 text-center text-muted-foreground"
|
|
138
143
|
>
|
|
139
144
|
Sin renglones
|
|
@@ -154,18 +159,20 @@ export function DynamicLineItems({ field, value, onChange, disabled = false, for
|
|
|
154
159
|
/>
|
|
155
160
|
</td>
|
|
156
161
|
))}
|
|
157
|
-
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
162
|
+
{!lockRows && (
|
|
163
|
+
<td className="px-2 py-1.5 text-center">
|
|
164
|
+
<Button
|
|
165
|
+
type="button"
|
|
166
|
+
variant="ghost"
|
|
167
|
+
size="icon"
|
|
168
|
+
onClick={() => removeRow(idx)}
|
|
169
|
+
disabled={disabled}
|
|
170
|
+
aria-label="Eliminar renglón"
|
|
171
|
+
>
|
|
172
|
+
<Trash2 className="h-4 w-4 text-red-500" />
|
|
173
|
+
</Button>
|
|
174
|
+
</td>
|
|
175
|
+
)}
|
|
169
176
|
</tr>
|
|
170
177
|
))}
|
|
171
178
|
</tbody>
|
|
@@ -197,17 +204,21 @@ export function DynamicLineItems({ field, value, onChange, disabled = false, for
|
|
|
197
204
|
</td>
|
|
198
205
|
)
|
|
199
206
|
})}
|
|
200
|
-
<td />
|
|
207
|
+
{!lockRows && <td />}
|
|
201
208
|
</tr>
|
|
202
209
|
</tfoot>
|
|
203
210
|
)}
|
|
204
211
|
</table>
|
|
205
212
|
</div>
|
|
206
213
|
<div className="flex items-center justify-between gap-2">
|
|
207
|
-
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
|
|
214
|
+
{lockRows ? (
|
|
215
|
+
<span />
|
|
216
|
+
) : (
|
|
217
|
+
<Button type="button" variant="outline" size="sm" onClick={addRow} disabled={disabled}>
|
|
218
|
+
<Plus className="mr-1 h-4 w-4" />
|
|
219
|
+
Agregar renglón
|
|
220
|
+
</Button>
|
|
221
|
+
)}
|
|
211
222
|
{balance && <BalanceBadge state={balance} />}
|
|
212
223
|
</div>
|
|
213
224
|
</div>
|
package/src/types.ts
CHANGED
|
@@ -443,6 +443,16 @@ export interface ActionFieldDef {
|
|
|
443
443
|
* reconcile. Mirrors kernel v3 `ActionField.balance`.
|
|
444
444
|
*/
|
|
445
445
|
balance?: FieldBalanceRule
|
|
446
|
+
/**
|
|
447
|
+
* On a line-items (`type: "array"`) field: fixes the set of rows. When true
|
|
448
|
+
* the SDK hides the "Agregar renglón" button and the per-row delete control,
|
|
449
|
+
* so the rows served (e.g. a prefilled set of allocations) can only have
|
|
450
|
+
* their cells edited — never added to or removed. Generic & domain-agnostic.
|
|
451
|
+
* Mirrors kernel v3 `ActionField.lock_rows`. Tolerates the camelCase alias.
|
|
452
|
+
*/
|
|
453
|
+
lock_rows?: boolean
|
|
454
|
+
/** camelCase alias for `lock_rows`. */
|
|
455
|
+
lockRows?: boolean
|
|
446
456
|
/**
|
|
447
457
|
* `upload` widget: comma-separated accept list forwarded to the file input
|
|
448
458
|
* `accept` attribute (e.g. `"image/*,.pdf"`). Tolerates the snake_case the
|