@asteby/metacore-runtime-react 13.8.2 → 13.8.5
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 +19 -0
- package/dist/action-modal-dispatcher.js +1 -1
- package/dist/dialogs/dynamic-record.js +1 -1
- package/dist/dynamic-form.js +2 -2
- package/dist/dynamic-line-items.js +2 -2
- package/dist/dynamic-select-field.d.ts.map +1 -1
- package/dist/dynamic-select-field.js +5 -1
- package/package.json +1 -1
- package/src/action-modal-dispatcher.tsx +1 -1
- package/src/dialogs/dynamic-record.tsx +1 -1
- package/src/dynamic-form.tsx +2 -2
- package/src/dynamic-line-items.tsx +2 -2
- package/src/dynamic-select-field.tsx +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @asteby/metacore-runtime-react
|
|
2
2
|
|
|
3
|
+
## 13.8.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- acb5dcc: fix: every basic `select` field fills its column (`w-full`). shadcn's SelectTrigger defaults to `w-fit`, so enum/option selects shrank to their content instead of aligning with text inputs and FK comboboxes. Covers the declarative action modal (`ActionModalDispatcher`), the record dialog, and line-item rows — the actual renderers behind a model's `placement:create` modal.
|
|
8
|
+
|
|
9
|
+
## 13.8.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7465943: fix(dynamic-form): basic `select` fields fill their column (`w-full`). shadcn's SelectTrigger defaults to `w-fit`, so enum/option selects shrank to their content instead of lining up with text inputs and FK comboboxes. Applies to both the plain `select` renderer and `RefSelect`.
|
|
14
|
+
|
|
15
|
+
## 13.8.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- dc3d079: fix(dynamic-select): constrain the combobox+"+" row to its grid cell. The wrapper lacked `w-full min-w-0`, so in a 2-column form the row sized to its content (the long empty-state placeholder) and overflowed the column, pushing the inline-create "+" off-screen — it only fit once a short value was selected. Add `w-full min-w-0`.
|
|
20
|
+
- 177415d: fix(dynamic-select): repair JSX syntax broken in #332 — the wrapper-row comment was a sibling of the root element inside `return (`, which is invalid and failed the release build (TS1005). Moved it to a `//` comment above `return`. The `w-full min-w-0` grid-cell constraint (the actual `+`-overlap fix) is unchanged.
|
|
21
|
+
|
|
3
22
|
## 13.8.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -165,7 +165,7 @@ function renderField(field, value, onChange) {
|
|
|
165
165
|
case 'textarea':
|
|
166
166
|
return _jsx(Textarea, { id: field.key, value: value || '', onChange: (e) => onChange(e.target.value), placeholder: field.placeholder });
|
|
167
167
|
case 'select':
|
|
168
|
-
return (_jsxs(Select, { value: value || '', onValueChange: onChange, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: field.placeholder || 'Seleccionar...' }) }), _jsx(SelectContent, { children: field.options?.map((opt) => _jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })] }));
|
|
168
|
+
return (_jsxs(Select, { value: value || '', onValueChange: onChange, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, { placeholder: field.placeholder || 'Seleccionar...' }) }), _jsx(SelectContent, { children: field.options?.map((opt) => _jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })] }));
|
|
169
169
|
case 'switch':
|
|
170
170
|
return _jsx(Switch, { id: field.key, checked: !!value, onCheckedChange: onChange });
|
|
171
171
|
case 'number':
|
|
@@ -270,7 +270,7 @@ function EditField({ field, value, onChange }) {
|
|
|
270
270
|
return _jsx(SearchField, { field: { ...field, type: 'search' }, value: value, onChange: onChange });
|
|
271
271
|
}
|
|
272
272
|
if (field.type === 'select' && field.options?.length) {
|
|
273
|
-
return (_jsxs(Select, { value: String(value ?? ''), onValueChange: onChange, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: "Seleccionar..." }) }), _jsx(SelectContent, { children: field.options.map(opt => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] }));
|
|
273
|
+
return (_jsxs(Select, { value: String(value ?? ''), onValueChange: onChange, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, { placeholder: "Seleccionar..." }) }), _jsx(SelectContent, { children: field.options.map(opt => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] }));
|
|
274
274
|
}
|
|
275
275
|
if (field.type === 'color') {
|
|
276
276
|
return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("input", { type: "color", value: value || '#6366f1', onChange: (e) => onChange(e.target.value), className: "h-9 w-14 cursor-pointer rounded-md border p-1" }), _jsx(Input, { value: value || '', onChange: (e) => onChange(e.target.value), placeholder: "#6366f1", className: "flex-1 h-9" })] }));
|
package/dist/dynamic-form.js
CHANGED
|
@@ -116,7 +116,7 @@ function FieldRenderer({ field, value, onChange }) {
|
|
|
116
116
|
case 'color':
|
|
117
117
|
return _jsx(Input, { id: field.key, type: "color", value: value || '#000000', onChange: (e) => onChange(e.target.value) });
|
|
118
118
|
case 'select':
|
|
119
|
-
return (_jsxs(Select, { value: value || '', onValueChange: onChange, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: field.placeholder || 'Seleccionar...' }) }), _jsx(SelectContent, { children: field.options?.map((opt) => _jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })] }));
|
|
119
|
+
return (_jsxs(Select, { value: value || '', onValueChange: onChange, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, { placeholder: field.placeholder || 'Seleccionar...' }) }), _jsx(SelectContent, { children: field.options?.map((opt) => _jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })] }));
|
|
120
120
|
case 'switch':
|
|
121
121
|
return _jsx(Switch, { id: field.key, checked: !!value, onCheckedChange: onChange });
|
|
122
122
|
case 'number':
|
|
@@ -133,5 +133,5 @@ function RefSelect({ field, value, onChange }) {
|
|
|
133
133
|
fieldKey: 'id',
|
|
134
134
|
ref: field.ref,
|
|
135
135
|
});
|
|
136
|
-
return (_jsxs(Select, { value: value || '', onValueChange: onChange, disabled: loading, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: loading ? 'Cargando…' : (field.placeholder || 'Seleccionar...') }) }), _jsx(SelectContent, { children: options.map((opt) => (_jsx(SelectItem, { value: String(opt.id), children: opt.label }, String(opt.id)))) })] }));
|
|
136
|
+
return (_jsxs(Select, { value: value || '', onValueChange: onChange, disabled: loading, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, { placeholder: loading ? 'Cargando…' : (field.placeholder || 'Seleccionar...') }) }), _jsx(SelectContent, { children: options.map((opt) => (_jsx(SelectItem, { value: String(opt.id), children: opt.label }, String(opt.id)))) })] }));
|
|
137
137
|
}
|
|
@@ -97,7 +97,7 @@ function CellRenderer({ field, value, onChange, disabled }) {
|
|
|
97
97
|
case 'color':
|
|
98
98
|
return (_jsx(Input, { type: "color", value: value || '#000000', onChange: (e) => onChange(e.target.value), disabled: disabled }));
|
|
99
99
|
case 'select':
|
|
100
|
-
return (_jsxs(Select, { value: value || '', onValueChange: onChange, disabled: disabled, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: field.placeholder || 'Seleccionar...' }) }), _jsx(SelectContent, { children: field.options?.map((opt) => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] }));
|
|
100
|
+
return (_jsxs(Select, { value: value || '', onValueChange: onChange, disabled: disabled, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, { placeholder: field.placeholder || 'Seleccionar...' }) }), _jsx(SelectContent, { children: field.options?.map((opt) => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] }));
|
|
101
101
|
case 'switch':
|
|
102
102
|
return _jsx(Switch, { checked: !!value, onCheckedChange: onChange, disabled: disabled });
|
|
103
103
|
case 'number':
|
|
@@ -114,5 +114,5 @@ function RefCell({ field, value, onChange, disabled }) {
|
|
|
114
114
|
fieldKey: 'id',
|
|
115
115
|
ref: field.ref,
|
|
116
116
|
});
|
|
117
|
-
return (_jsxs(Select, { value: value || '', onValueChange: onChange, disabled: disabled || loading, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, { placeholder: loading ? 'Cargando…' : field.placeholder || 'Seleccionar...' }) }), _jsx(SelectContent, { children: options.map((opt) => (_jsx(SelectItem, { value: String(opt.id), children: opt.label }, String(opt.id)))) })] }));
|
|
117
|
+
return (_jsxs(Select, { value: value || '', onValueChange: onChange, disabled: disabled || loading, children: [_jsx(SelectTrigger, { className: "w-full", children: _jsx(SelectValue, { placeholder: loading ? 'Cargando…' : field.placeholder || 'Seleccionar...' }) }), _jsx(SelectContent, { children: options.map((opt) => (_jsx(SelectItem, { value: String(opt.id), children: opt.label }, String(opt.id)))) })] }));
|
|
118
118
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-select-field.d.ts","sourceRoot":"","sources":["../src/dynamic-select-field.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAW7C,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,cAAc,CAAA;IACrB,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;CAC7B;AAED,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"dynamic-select-field.d.ts","sourceRoot":"","sources":["../src/dynamic-select-field.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAW7C,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,cAAc,CAAA;IACrB,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;CAC7B;AAED,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,uBAAuB,2CAoJrF;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -84,7 +84,11 @@ export function DynamicSelectField({ field, value, onChange }) {
|
|
|
84
84
|
},
|
|
85
85
|
}));
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
// w-full + min-w-0: as a grid cell child, the row must be allowed to shrink
|
|
88
|
+
// to the cell. Without min-w-0 the combobox+button row sizes to its content
|
|
89
|
+
// (the long empty-state placeholder) and overflows the column, pushing the
|
|
90
|
+
// "+" off-screen — it only "fit" once a short value was selected.
|
|
91
|
+
return (_jsxs("div", { className: "flex w-full min-w-0 items-center gap-1.5", children: [_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "outline", role: "combobox", "aria-expanded": open, id: field.key, className: "min-w-0 flex-1 justify-between font-normal", "data-empty": !value, children: [_jsx("span", { className: 'min-w-0 flex-1 truncate text-left ' + (selectedLabel ? '' : 'text-muted-foreground'), children: selectedLabel || field.placeholder || 'Buscar…' }), _jsx(ChevronsUpDown, { className: "ml-2 size-4 shrink-0 opacity-50" })] }) }), _jsx(PopoverContent, { className: "p-0", align: "start",
|
|
88
92
|
// Match the trigger width without an arbitrary Tailwind class
|
|
89
93
|
// (those don't always survive a consuming app's Tailwind scan).
|
|
90
94
|
style: { width: 'var(--radix-popover-trigger-width)' }, children: _jsxs(Command, { shouldFilter: false, children: [_jsx(CommandInput, { placeholder: field.placeholder || 'Buscar…', value: search, onValueChange: setSearch }), _jsxs(CommandList, { children: [loading && (_jsxs("div", { className: "text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm", children: [_jsx(Loader2, { className: "size-4 animate-spin" }), "Buscando\u2026"] })), !loading && options.length === 0 && (_jsx(CommandEmpty, { children: debounced ? 'Sin resultados' : 'Escribí para buscar…' })), !loading && options.length > 0 && (_jsx(CommandGroup, { className: "max-h-64 overflow-auto", children: options.map((opt) => {
|
package/package.json
CHANGED
|
@@ -334,7 +334,7 @@ function renderField(
|
|
|
334
334
|
case 'select':
|
|
335
335
|
return (
|
|
336
336
|
<Select value={value || ''} onValueChange={onChange}>
|
|
337
|
-
<SelectTrigger><SelectValue placeholder={field.placeholder || 'Seleccionar...'} /></SelectTrigger>
|
|
337
|
+
<SelectTrigger className="w-full"><SelectValue placeholder={field.placeholder || 'Seleccionar...'} /></SelectTrigger>
|
|
338
338
|
<SelectContent>
|
|
339
339
|
{field.options?.map((opt) => <SelectItem key={opt.value} value={opt.value}>{opt.label}</SelectItem>)}
|
|
340
340
|
</SelectContent>
|
|
@@ -581,7 +581,7 @@ function EditField({ field, value, onChange }: {
|
|
|
581
581
|
if (field.type === 'select' && field.options?.length) {
|
|
582
582
|
return (
|
|
583
583
|
<Select value={String(value ?? '')} onValueChange={onChange}>
|
|
584
|
-
<SelectTrigger>
|
|
584
|
+
<SelectTrigger className="w-full">
|
|
585
585
|
<SelectValue placeholder="Seleccionar..." />
|
|
586
586
|
</SelectTrigger>
|
|
587
587
|
<SelectContent>
|
package/src/dynamic-form.tsx
CHANGED
|
@@ -195,7 +195,7 @@ function FieldRenderer({ field, value, onChange }: FieldRendererProps) {
|
|
|
195
195
|
case 'select':
|
|
196
196
|
return (
|
|
197
197
|
<Select value={value || ''} onValueChange={onChange}>
|
|
198
|
-
<SelectTrigger><SelectValue placeholder={field.placeholder || 'Seleccionar...'} /></SelectTrigger>
|
|
198
|
+
<SelectTrigger className="w-full"><SelectValue placeholder={field.placeholder || 'Seleccionar...'} /></SelectTrigger>
|
|
199
199
|
<SelectContent>
|
|
200
200
|
{field.options?.map((opt) => <SelectItem key={opt.value} value={opt.value}>{opt.label}</SelectItem>)}
|
|
201
201
|
</SelectContent>
|
|
@@ -220,7 +220,7 @@ function RefSelect({ field, value, onChange }: FieldRendererProps) {
|
|
|
220
220
|
})
|
|
221
221
|
return (
|
|
222
222
|
<Select value={value || ''} onValueChange={onChange} disabled={loading}>
|
|
223
|
-
<SelectTrigger>
|
|
223
|
+
<SelectTrigger className="w-full">
|
|
224
224
|
<SelectValue placeholder={loading ? 'Cargando…' : (field.placeholder || 'Seleccionar...')} />
|
|
225
225
|
</SelectTrigger>
|
|
226
226
|
<SelectContent>
|
|
@@ -274,7 +274,7 @@ function CellRenderer({ field, value, onChange, disabled }: CellRendererProps) {
|
|
|
274
274
|
case 'select':
|
|
275
275
|
return (
|
|
276
276
|
<Select value={value || ''} onValueChange={onChange} disabled={disabled}>
|
|
277
|
-
<SelectTrigger>
|
|
277
|
+
<SelectTrigger className="w-full">
|
|
278
278
|
<SelectValue placeholder={field.placeholder || 'Seleccionar...'} />
|
|
279
279
|
</SelectTrigger>
|
|
280
280
|
<SelectContent>
|
|
@@ -328,7 +328,7 @@ function RefCell({ field, value, onChange, disabled }: CellRendererProps) {
|
|
|
328
328
|
})
|
|
329
329
|
return (
|
|
330
330
|
<Select value={value || ''} onValueChange={onChange} disabled={disabled || loading}>
|
|
331
|
-
<SelectTrigger>
|
|
331
|
+
<SelectTrigger className="w-full">
|
|
332
332
|
<SelectValue placeholder={loading ? 'Cargando…' : field.placeholder || 'Seleccionar...'} />
|
|
333
333
|
</SelectTrigger>
|
|
334
334
|
<SelectContent>
|
|
@@ -110,8 +110,12 @@ export function DynamicSelectField({ field, value, onChange }: DynamicSelectFiel
|
|
|
110
110
|
)
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// w-full + min-w-0: as a grid cell child, the row must be allowed to shrink
|
|
114
|
+
// to the cell. Without min-w-0 the combobox+button row sizes to its content
|
|
115
|
+
// (the long empty-state placeholder) and overflows the column, pushing the
|
|
116
|
+
// "+" off-screen — it only "fit" once a short value was selected.
|
|
113
117
|
return (
|
|
114
|
-
<div className="flex items-center gap-1.5">
|
|
118
|
+
<div className="flex w-full min-w-0 items-center gap-1.5">
|
|
115
119
|
<Popover open={open} onOpenChange={setOpen}>
|
|
116
120
|
<PopoverTrigger asChild>
|
|
117
121
|
<Button
|