@object-ui/fields 4.0.5 → 4.0.6
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 +40 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +905 -903
- package/package.json +7 -7
- package/src/index.tsx +9 -3
- package/src/widgets/FileField.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/fields",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "Field renderers and registry for Object UI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"clsx": "^2.1.1",
|
|
28
28
|
"lucide-react": "^1.14.0",
|
|
29
29
|
"tailwind-merge": "^3.5.0",
|
|
30
|
-
"@object-ui/components": "4.0.
|
|
31
|
-
"@object-ui/core": "4.0.
|
|
32
|
-
"@object-ui/i18n": "4.0.
|
|
33
|
-
"@object-ui/providers": "4.0.
|
|
34
|
-
"@object-ui/react": "4.0.
|
|
35
|
-
"@object-ui/types": "4.0.
|
|
30
|
+
"@object-ui/components": "4.0.6",
|
|
31
|
+
"@object-ui/core": "4.0.6",
|
|
32
|
+
"@object-ui/i18n": "4.0.6",
|
|
33
|
+
"@object-ui/providers": "4.0.6",
|
|
34
|
+
"@object-ui/react": "4.0.6",
|
|
35
|
+
"@object-ui/types": "4.0.6"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": "^18.0.0 || ^19.0.0",
|
package/src/index.tsx
CHANGED
|
@@ -290,7 +290,7 @@ export function PercentCellRenderer({ value, field }: CellRendererProps): React.
|
|
|
290
290
|
return (
|
|
291
291
|
<div className="flex items-center gap-2">
|
|
292
292
|
<div
|
|
293
|
-
className="h-1.5 w-16 rounded-full bg-muted overflow-hidden
|
|
293
|
+
className="h-1.5 w-16 rounded-full bg-muted overflow-hidden shrink-0"
|
|
294
294
|
role="progressbar"
|
|
295
295
|
aria-valuenow={clampedBar}
|
|
296
296
|
aria-valuemin={0}
|
|
@@ -1217,7 +1217,11 @@ const fieldWidgetMap: Record<string, () => Promise<{ default: React.ComponentTyp
|
|
|
1217
1217
|
'markdown': () => import('./widgets/RichTextField').then(m => ({ default: m.RichTextField })),
|
|
1218
1218
|
'html': () => import('./widgets/RichTextField').then(m => ({ default: m.RichTextField })),
|
|
1219
1219
|
'lookup': () => import('./widgets/LookupField').then(m => ({ default: m.LookupField })),
|
|
1220
|
-
|
|
1220
|
+
// master_detail represents the child-side FK to its parent. In create/edit forms it
|
|
1221
|
+
// must render as a single-value lookup picker (it is typically NOT NULL). The legacy
|
|
1222
|
+
// MasterDetailField widget modelled this as a one-to-many list, which is incorrect
|
|
1223
|
+
// for the child-side and prevented users from filling the required parent reference.
|
|
1224
|
+
'master_detail': () => import('./widgets/LookupField').then(m => ({ default: m.LookupField })),
|
|
1221
1225
|
|
|
1222
1226
|
// File fields
|
|
1223
1227
|
'file': () => import('./widgets/FileField').then(m => ({ default: m.FileField })),
|
|
@@ -1317,7 +1321,9 @@ export function registerFields() {
|
|
|
1317
1321
|
ComponentRegistry.register('markdown', createFieldRenderer(RichTextField), { namespace: 'field' });
|
|
1318
1322
|
ComponentRegistry.register('html', createFieldRenderer(RichTextField), { namespace: 'field' });
|
|
1319
1323
|
ComponentRegistry.register('lookup', createFieldRenderer(LookupField), { namespace: 'field' });
|
|
1320
|
-
|
|
1324
|
+
// master_detail = child-side FK lookup (single value, typically required). See
|
|
1325
|
+
// fieldWidgetMap above for rationale.
|
|
1326
|
+
ComponentRegistry.register('master_detail', createFieldRenderer(LookupField), { namespace: 'field' });
|
|
1321
1327
|
|
|
1322
1328
|
// File fields
|
|
1323
1329
|
ComponentRegistry.register('file', createFieldRenderer(FileField), { namespace: 'field' });
|
|
@@ -266,11 +266,11 @@ export function FileField({ value, onChange, field, readonly, ...props }: FieldW
|
|
|
266
266
|
>
|
|
267
267
|
<div className="flex items-center gap-2 flex-1 min-w-0">
|
|
268
268
|
{isImage(file) && file.url ? (
|
|
269
|
-
<img src={file.url} alt={file.name} className="size-8 object-cover rounded
|
|
269
|
+
<img src={file.url} alt={file.name} className="size-8 object-cover rounded shrink-0" />
|
|
270
270
|
) : isImage(file) ? (
|
|
271
|
-
<ImageIcon className="size-4 text-muted-foreground
|
|
271
|
+
<ImageIcon className="size-4 text-muted-foreground shrink-0" />
|
|
272
272
|
) : (
|
|
273
|
-
<FileIcon className="size-4 text-muted-foreground
|
|
273
|
+
<FileIcon className="size-4 text-muted-foreground shrink-0" />
|
|
274
274
|
)}
|
|
275
275
|
<span className="text-sm truncate">
|
|
276
276
|
{file.name || file.original_name || 'File'}
|