@object-ui/fields 14.0.0 → 14.1.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 +162 -0
- package/README.md +11 -0
- package/dist/__tests__/lookupCellDisplayField.test.d.ts +0 -0
- package/dist/__tests__/lookupCellDisplayName.test.d.ts +0 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +20 -8
- package/dist/index.js +1222 -1033
- package/dist/widgets/FileField.d.ts +22 -0
- package/dist/widgets/GridField.d.ts +6 -2
- package/dist/widgets/SelectField.d.ts +1 -1
- package/package.json +7 -7
- package/src/__tests__/DateCellRenderer.test.tsx +27 -4
- package/src/__tests__/lookupCellDisplayField.test.tsx +107 -0
- package/src/__tests__/lookupCellDisplayName.test.tsx +119 -0
- package/src/index.tsx +219 -39
- package/src/standard-widgets.test.tsx +35 -0
- package/src/widgets/CurrencyField.tsx +5 -0
- package/src/widgets/FileField.tsx +170 -28
- package/src/widgets/GridField.test.tsx +84 -1
- package/src/widgets/GridField.tsx +32 -2
- package/src/widgets/LookupField.tsx +12 -2
- package/src/widgets/NumberField.tsx +14 -2
- package/src/widgets/PeoplePicker.test.tsx +6 -0
- package/src/widgets/PeoplePicker.tsx +11 -2
- package/src/widgets/SelectField.cascade.test.tsx +3 -3
- package/src/widgets/SelectField.tsx +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -57,22 +57,29 @@ export declare function formatPercent(value: number, precision?: number): string
|
|
|
57
57
|
* "active" → "Active"
|
|
58
58
|
*/
|
|
59
59
|
export declare function humanizeLabel(value: string): string;
|
|
60
|
+
/** Options shared by {@link formatDate} / {@link formatRelativeDate}. */
|
|
61
|
+
export interface DateDisplayOptions {
|
|
62
|
+
dueLike?: boolean;
|
|
63
|
+
/** BCP-47 display locale (ADR-0053 tenant default); falls back to the runtime locale. */
|
|
64
|
+
locale?: string;
|
|
65
|
+
/** i18n translate fn for phrases `Intl` can't produce (the "Overdue Nd" wording). */
|
|
66
|
+
t?: (key: string, params?: Record<string, unknown>) => string;
|
|
67
|
+
}
|
|
60
68
|
/**
|
|
61
|
-
* Format date as relative time (e.g., "
|
|
69
|
+
* Format date as relative time (e.g., "3 days ago", "Today", "Overdue 3d"),
|
|
70
|
+
* localized via `Intl.RelativeTimeFormat` (objectstack-ai/framework#3040).
|
|
62
71
|
*
|
|
63
72
|
* `dueLike` gates the "Overdue" wording — a past `start_date`/`created_at`
|
|
64
73
|
* isn't overdue, only a past due/deadline-semantic field is. Non-due-like
|
|
65
|
-
* past dates render as "
|
|
74
|
+
* past dates render as plain "N days ago" instead. The overdue phrase has no
|
|
75
|
+
* `Intl` equivalent, so it resolves through `options.t` (key
|
|
76
|
+
* `fields.relativeDate.overdue`) with an English fallback.
|
|
66
77
|
*/
|
|
67
|
-
export declare function formatRelativeDate(value: string | Date | number, options?:
|
|
68
|
-
dueLike?: boolean;
|
|
69
|
-
}): string;
|
|
78
|
+
export declare function formatRelativeDate(value: string | Date | number, options?: DateDisplayOptions): string;
|
|
70
79
|
/**
|
|
71
80
|
* Format date value
|
|
72
81
|
*/
|
|
73
|
-
export declare function formatDate(value: string | Date | number, style?: string, options?:
|
|
74
|
-
dueLike?: boolean;
|
|
75
|
-
}): string;
|
|
82
|
+
export declare function formatDate(value: string | Date | number, style?: string, options?: DateDisplayOptions): string;
|
|
76
83
|
/**
|
|
77
84
|
* Format datetime value
|
|
78
85
|
*/
|
|
@@ -167,6 +174,11 @@ export declare function ImageCellRenderer({ value }: CellRendererProps): React.R
|
|
|
167
174
|
* 3. Fetch-on-demand: when the value is a primitive ID and `field.reference_to`
|
|
168
175
|
* is known, resolve via dataSource and show the related record's display name.
|
|
169
176
|
* Falls back to a muted placeholder while pending and on failure.
|
|
177
|
+
*
|
|
178
|
+
* Record → name resolution (1 and 3) goes through the referenced object's
|
|
179
|
+
* schema when the data source exposes it (`displayField` → nameField/titleFormat
|
|
180
|
+
* → derivation, see {@link resolveLookupRecordName}), so the chip and the
|
|
181
|
+
* picker agree (issue #2357).
|
|
170
182
|
*/
|
|
171
183
|
export declare function LookupCellRenderer({ value, field }: CellRendererProps): React.ReactElement;
|
|
172
184
|
/**
|