@object-ui/fields 11.4.0 → 13.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 +115 -0
- package/README.md +11 -0
- package/dist/__tests__/DateCellRenderer.test.d.ts +0 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +15 -2
- package/dist/index.js +1555 -1497
- package/dist/widgets/SelectField.cascade.test.d.ts +0 -0
- package/dist/widgets/SelectField.d.ts +10 -3
- package/dist/widgets/openNativePicker.d.ts +11 -0
- package/package.json +8 -8
- package/src/__tests__/DateCellRenderer.test.tsx +50 -0
- package/src/index.tsx +64 -27
- package/src/widgets/DateField.tsx +5 -0
- package/src/widgets/DateTimeField.tsx +5 -0
- package/src/widgets/SelectField.cascade.test.tsx +138 -0
- package/src/widgets/SelectField.tsx +74 -14
- package/src/widgets/TimeField.tsx +5 -0
- package/src/widgets/openNativePicker.ts +18 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { FieldMetadata } from '@object-ui/types';
|
|
3
3
|
import { resolveFieldCurrency } from './currency';
|
|
4
|
+
/**
|
|
5
|
+
* Pick the most reasonable display name from an arbitrary record object.
|
|
6
|
+
* Tries common name-like keys in priority order, then falls back to undefined.
|
|
7
|
+
*/
|
|
8
|
+
export declare function pickRecordDisplayName(record: Record<string, unknown> | null | undefined, preferredField?: string): string | undefined;
|
|
4
9
|
/**
|
|
5
10
|
* Heuristic: detect strings that look like opaque foreign-key IDs (e.g. nanoid
|
|
6
11
|
* or BSON ObjectId). Used so we don't display random gibberish to users when
|
|
@@ -54,12 +59,20 @@ export declare function formatPercent(value: number, precision?: number): string
|
|
|
54
59
|
export declare function humanizeLabel(value: string): string;
|
|
55
60
|
/**
|
|
56
61
|
* Format date as relative time (e.g., "2 days ago", "Today", "Overdue 3d")
|
|
62
|
+
*
|
|
63
|
+
* `dueLike` gates the "Overdue" wording — a past `start_date`/`created_at`
|
|
64
|
+
* isn't overdue, only a past due/deadline-semantic field is. Non-due-like
|
|
65
|
+
* past dates render as "Nd ago" instead.
|
|
57
66
|
*/
|
|
58
|
-
export declare function formatRelativeDate(value: string | Date | number
|
|
67
|
+
export declare function formatRelativeDate(value: string | Date | number, options?: {
|
|
68
|
+
dueLike?: boolean;
|
|
69
|
+
}): string;
|
|
59
70
|
/**
|
|
60
71
|
* Format date value
|
|
61
72
|
*/
|
|
62
|
-
export declare function formatDate(value: string | Date | number, style?: string
|
|
73
|
+
export declare function formatDate(value: string | Date | number, style?: string, options?: {
|
|
74
|
+
dueLike?: boolean;
|
|
75
|
+
}): string;
|
|
63
76
|
/**
|
|
64
77
|
* Format datetime value
|
|
65
78
|
*/
|